文字列を持つ静的ReadOnlyCollection
を作成したいとします。静的な読み取り専用の文字列のコレクションの割り当て
この式を何らかの方法で短くするか、よりエレガントにする方法はありますか?
public static readonly ReadOnlyCollection<string> ErrorList = new ReadOnlyCollection<string>(
new string[] {
"string1",
"string2",
"string3",
}
);
私はこれを何回も使用しますが、ファイルは異なります。
あなたは '新しい文字列[] {...'で 'STRING'を省略することができませんでしたが、何か... – SWeko