Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# object to dictionary

public static Dictionary<string, TValue> ToDictionary<TValue>(object obj)
{       
    var json = JsonConvert.SerializeObject(obj);
    var dictionary = JsonConvert.DeserializeObject<Dictionary<string, TValue>>(json);   
    return dictionary;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #object #dictionary
ADD COMMENT
Topic
Name
6+5 =