Maksim Vi. Maksim Vi. - 5 months ago 23
ASP.NET (C#) Question

Asp.Net Deserialize Dictionary<string, object> to an object

What would be the best way to deserialize this

Dictionary<string, object>{
{"fName", "John"},
{"lName", "Doe"},
{"email", ""}

to this

class Member{
string fName;
string lName;
string email;


This isn't really serialization in the normal sense, that usually refers to taking some disk or network formatted data (binary, ASCII, JSON etc) and loading it into a runtime object.

However, if I understand you correctly, I think what you are trying to do is...

public Member( Dictionary<string,object> dictionary )
    fName = dictionary["fName"];
    lName = dictionary["lName"];
    email = dictionary["email"];

// usage Member m = new Member( inputDictionary );