Last active
December 14, 2022 13:56
-
-
Save lilacs2039/9337bb3bfc04c6c62b98b38cf6f9a3fd to your computer and use it in GitHub Desktop.
My Practice Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snippets for bat | |
[[tagGroup]] | |
name = "操作" | |
tags = "移動,コピー,開く,作成,変更,削除" | |
description = "" | |
[[tagGroup]] | |
name = "ファイル" | |
tags = "ファイル,フォルダ,ルート,カレント,ディレクトリ,書,読" | |
description = "" | |
[[tagGroup]] | |
name = "その他" | |
tags = "待つ,検索,文字,変数,サブルーチン,コメント,画面,通信" | |
description = "" | |
["サブルーチン"] | |
icon = "code" | |
description = """ | |
サブルーチンのテンプレート | |
""" | |
code = """ | |
:_{label}_ | |
_[サブルーチン処理]_ | |
exit /b | |
""" | |
["ファイルが存在すれば削除"] | |
icon = "empty-trash" | |
description = """ | |
ファイルが存在するか確認して、存在すれば削除する。 | |
""" | |
code = """ | |
set DEL_FILE=_{削除するファイル名}_ | |
if exist %DEL_FILE% ( del %DEL_FILE% ) | |
""" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# snippets for C# | |
[[tagGroup]] | |
name = "操作" | |
tags = "移動,コピー,開く,作成,変更,削除,ソート" | |
[[tagGroup]] | |
name = "その他" | |
tags = "Linq,文字列" | |
["Listの中身を文字列に変換(String.Join)"] | |
icon = "unknown" | |
description = """ | |
""" | |
code = """ | |
String.Join(", ", _{文字列配列・リスト}_); | |
""" | |
["降順に並び替え(ソート)(Linq)"] | |
icon = "unknown" | |
description = """ | |
OrderBy : 昇順にソート | |
OrderByDescending : 降順にソート | |
ThenBy : 昇順にソート(第2キー以降) | |
ThenByDescending : 降順にソート(第2キー以降) | |
引用元 https://www.buildinsider.net/web/bookaspmvc5/050303 | |
""" | |
code = """ | |
var articles = db.Articles | |
.OrderByDescending(a => a.Published) | |
.ThenBy(a => a.Title); | |
""" | |
["辞書のForeach(Linq)"] | |
icon = "unknown" | |
description = """ | |
DictionaryにForEachは定義されてないが、ToList()でKeyValuePairのリストに変換できる。 | |
""" | |
code = """ | |
dic.ToList().ForEach(kvp => Console.WriteLine($"{kvp.Key}, {kvp.Value}")); | |
""" | |
["辞書の初期化"] | |
icon = "unknown" | |
description = """ | |
引用元 C#のDictionaryとは?定義方法と基本的な使い方【初心者向け】 | Modis株式会社 | |
https://www.modis.co.jp/candidate/insight/column_136 | |
""" | |
code = """ | |
//インスタンス化と初期化を同時に実行 | |
var mydic2 = new Dictionary<string, string>(){ | |
{"mykey1","value11"}, | |
{"mykey2","value12"}, | |
{"mykey3","value13"} | |
}; | |
""" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment