c# object 动态增加属性和值
var list = new List<T>();
foreach (var item in rfcdata)
{
T t = new T();
IDictionary<string, object> result = new ExpandoObject();
//循环原本数据,放入reuslt
foreach (var itemmin2 in t.GetType().GetProperties())
{
result.Add(itemmin2.Name, itemmin2.GetValue(itemmin2));
}
//循环新增数据,放入reuslt
foreach (var itemin in clounms)
{
result.Add(itemin, item.GetValue(itemin));
}
//转成dynami类型 输出
list.Add(result as dynamic);
}
return list;