I have a ResourceDictionary only containing string keys and string values. Now I want to have a Dictionary< string, string > with the same content.
How would you do that? Whats the fastest solution in C#?
Edit: Fastest in terms of perfomance ;)
Fastest in terms of simplest? Assuming .NET 3.5 (and thus LINQ) I'd use:
resourceDictionary.Keys.Cast<string>().ToDictionary
(x => x, // Key selector
x => (string) resourceDictionary[x] // Value selector
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With