导航

.Net 中通过Reflection获得List成员类型

Posted on 2010-04-01 20:08  AlexCube  阅读(244)  评论(0编辑  收藏  举报
List<DateTime> lstDates = new List<DateTime>();
//这里不好直接用 lstDates[0].GetType() , lstDates 有可能为空。

Type typeoflist = lstDates.GetType().GetProperty("Item").PropertyType;

Console.WriteLine(typeoflist.ToString());