8,497
社区成员
发帖
与我相关
我的任务
分享
ArrayList arrayList = new ArrayList { new { ID = "119", Name = "csdn" } };
foreach (var item in arrayList)
{
PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(item);
PropertyDescriptor pdID = pdc.Find("ID", true);
var id = pdID.GetValue(item);
Console.WriteLine(id);
PropertyDescriptor pdName = pdc.Find("Name", true);
var name = pdName.GetValue(item);
Console.WriteLine(name);
}