Click here to Skip to main content
14,241,167 members
Rate this:
Please Sign up or sign in to vote.
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:

 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,....)
public class Customer
{
    //Fields, properties, methods and events go here...
}
Posted

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Please check the below solution.

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

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100