Chr*_*ann 4 c# wpf resourcedictionary
我有一个ResourceDictionary只包含字符串键和字符串值.现在我想要一个具有相同内容的Dictionary <string,string>.
你会怎么做?什么是C#中最快的解决方案?
编辑:性能最快;)
最简单的最快?假设.NET 3.5(以及LINQ)我使用:
resourceDictionary.Keys.Cast<string>().ToDictionary
(x => x, // Key selector
x => (string) resourceDictionary[x] // Value selector
);
Run Code Online (Sandbox Code Playgroud)