Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
dear all,
Is there any way to make a function that take the name of object and convert the data dictionary type to this object type

just by passing the name of object for ex:

C#
 public objectType function (the objectType,List<Dictionary<string, string>> _lstDic)
{
foreach (var kvpList in _lstDic)
JsonConvert.DeserializeObject<"objectType"(JsonConvert.SerializeObject(kvpList));
}

where objectType (person or Customer,....)
C#
public class Customer
{
    //Fields, properties, methods and events go here...
}
Posted

1 solution

Please check the below solution.

http://stackoverflow.com/questions/4943817/mapping-object-to-dictionary-and-vice-versa
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900