What is the leanest way to convert a Dictionary<string, string> to a Dictionary<string, object>?
c#, casting, dictionary
Solution
Try the following
var newMap = oldMap.ToDictionary(pair => pair.Key, pair=>(object)pair.Value);
Problem
I'm using an API that returns a key-value collection as a `Dictionary<string, string>`. I need to convert that to a `Dictionary<string, object>`. I have a sense that there should be a way to do this conversion/mapping without "manually" looping through each key-value pair, but Googling or the C# object reference didn't immediately yield a solution.