ascendingを付けた場合は、昇順になる。
orderby 句 - C# リファレンス | Microsoft Learn
MainClass.csで、
"orderby p.Height ascending"とすると、
また昇順になった。
Sample/cs/orderby/ascending/src/orderby at master · bg1bgst333/Sample · GitHub
ascendingを付けた場合は、昇順になる。
orderby 句 - C# リファレンス | Microsoft Learn
MainClass.csで、
"orderby p.Height ascending"とすると、
また昇順になった。
Sample/cs/orderby/ascending/src/orderby at master · bg1bgst333/Sample · GitHub
PathFindExtensionは、指定されたパスからドット(.)を含む拡張子部分だけを抽出する。
PathFindExtensionA 関数 (shwlapi.h) - Win32 apps | Microsoft Learn
PathFindExtension.cppで、
こう書く。
"text1.txt"から".txt"を抽出できた。
orderby句の一番後ろに、descendingを付けると、降順になる。
orderby 句 - C# リファレンス | Microsoft Learn
MainClass.csで、
"orderby p.Height descending"なので、p.Height(身長)の降順である。
降順になった。
Sample/cs/orderby/descending/src/orderby at master · bg1bgst333/Sample · GitHub
ファイル名部分の抽出は、GetFileTitleでもできる。
GetFileTitleW function (commdlg.h) - Win32 apps | Microsoft Learn
コモンダイアログの関数なので種類が違う。comdlg32.libのリンクは要らなかった。
以前やったOPENFILENAMEの項のソースコードをベースに、GetFileTitle.cppで、
GetOpenFileNameによるファイル選択で取得したパスを、GetFileTitleに渡してファイル名部分だけ取得し、SetWindowTextでウィンドウタイトルにセット。
Openを選択。
text1.txtを選択。
タイトルが"text1.txt"だけの表示に切り替わった。
Sample/winapi/GetFileTitle/GetFileTitle/src/GetFileTitle at master · bg1bgst333/Sample · GitHub
orderby句で要素をソートする。
orderby 句 - C# リファレンス | Microsoft Learn
Body.csは、以前のものと変わらない。
MainClass.csは、
orderbyだけならデフォルト昇順なので、p.Height(身長)の昇順でソートする。
p.Name(名前)がp.Height(身長)の昇順で取り出されてる。
Sample/cs/orderby/orderby/src/orderby at master · bg1bgst333/Sample · GitHub
PathFindFileNameは、指定されたパスからファイル名部分だけを抽出する。
PathFindFileNameA 関数 (shwlapi.h) - Win32 apps | Microsoft Learn
これはまたshlwapi.libのリンク必要。
PathFindFileName.cppは、
こう書く。
戻り値でファイル名文字列のポインタを返してくるのが特徴。
text1.txtだけ取り出せた。
where句で列挙する要素の条件を指定する。
where 句 - C# リファレンス | Microsoft Learn
Body.csは、以前のものと変わらない。
MainClass.csは、
from句とselext句の間に、where句でp.Heightが170以上という条件を追加する。
このように絞り込めた。
Sample/cs/where/where/src/where at master · bg1bgst333/Sample · GitHub