Dictionary<string,string>
C#ですべてのキーのインテリセンスを取得する方法はありますか?
または、文字列パラメーターを持つメソッドのインテリセンスを取得することは可能ですか?
私は持っているようなものを持ちたいですResourceManager.GetString("")
。可能であれば、それをシミュレートするために定数文字列を持つ静的クラスを作成したくありません。
編集:
現在、辞書を使用して複数のリソース ファイルを 1 つの辞書に結合しています。これは、リソースが複数のプロジェクトで使用され、上書きする必要があるためです。
var temp = ResourceFile1.ResourceManager
.GetResourceSet(CultureInfo.CurrentUICulture, true, true)
.Cast<object>()
.Select(
x => new
{
ID = 1,
Value = x.GetType().GetProperty("Value").GetValue(x, null).ToString(),
Key = x.GetType().GetProperty("Key").GetValue(x, null).ToString()
});
temp = temp.Concat(
ResourceFile2.ResourceManager
.GetResourceSet(CultureInfo.CurrentUICulture, true, true)
.Cast<object>()
.Select(
x => new
{
ID = 2,
Value = x.GetType().GetProperty("Value").GetValue(x, null).ToString(),
Key = x.GetType().GetProperty("Key").GetValue(x, null).ToString()
}));
temp = temp.Concat(
ResourceFile3.ResourceManager
.GetResourceSet(CultureInfo.CurrentUICulture, true, true)
.Cast<object>()
.Select(
x => new
{
ID = 3,
Value = x.GetType().GetProperty("Value").GetValue(x, null).ToString(),
Key = x.GetType().GetProperty("Key").GetValue(x, null).ToString()
}));
ResourceDictionary = temp.GroupBy(x => x.Key)
.Select(x => x.FirstOrDefault(c => c.ID == x.Max(v => v.ID)))
.ToDictionary(x => x.Key, x => x.Value);