List<匿名类> 访问属性


List<object> list = new List<object>(); list.Add(new { test1=1, test2=2,test3=3}); foreach (var item in list) {   PropertyDescriptorCollection pdc = TypeDescriptor.GetProperties(item);   PropertyDescriptor item1 = pdc.Find("test1", true);   var x = item1 .GetValue(item); }

 

posted on 2017-05-11 17:24  Frank-  阅读(2191)  评论(0编辑  收藏  举报

导航