Answers for "dictionary take c# to dictionary"

C#
0

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;
}
Posted by: Guest on November-10-2021
0

how to access a dictionary in c#

dic["key2"]; // gives "value2"
Posted by: Guest on October-08-2021

C# Answers by Framework

Browse Popular Code Answers by Language