c# - What is the leanest way to convert a Dictionary<string, string> to a Dictionary<string, object>? -


I am using an API that returns a key-value archive as a dictionary & Lt; String, string & gt; . Let me give it a dictionary & lt; String, Object & gt; I need to have a way of doing this without looping "manually" through this conversion / mapping of each key-value pair, but in the Googling or C # object context No solution found immediately.

try the following

  var newMap = oldMap.ToDictionary (pair = & Gt; pair.Key, pair => (object) pair.Value);  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

c++ - QtQuick: QQmlApplicationEngine failed to load component qrc:/main.qml:23 Invalid attached object assignment -