本文介绍了将数据字典转换为对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,

有没有办法制作一个带有对象名称并将数据字典类型转换为此对象类型的函数



只需将对象名称传递给ex:



  public  objectType函数(objectType,List< Dictionary< string,string>> _lstDic)
{
foreach > var kvpList in _lstDic)
JsonConvert.DeserializeObject< objectType(JsonConvert.SerializeObject(kvpList));
}



where objectType(person or Customer,....)

  public   class 客户
{
// 字段,属性,方法和事件都在这里......
}
解决方案

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...
}
解决方案


这篇关于将数据字典转换为对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 18:33
查看更多