System.Windows.Forms.Design.StringCollectionEditor を使用して、Windows フォーム プロパティ グリッド経由で List クラス メンバーを公開しようとしています。私の質問はスレッドセーフに関するものです
[Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
public List<string> EventLogSources {
get {
lock (lockObj) {
return eventLogSources;
}
}
}
複数のスレッドが参照を取得して更新する可能性があるため、明らかにこれはスレッドセーフではありません。では、StringCollectionEditor (または類似のもの) を使用してスレッドセーフにする最良の方法は何ですか?