Type type = pi.PropertyType;if(type.IsGenericType && type.GetGenericTypeDefinition() == typeof(List<>)){ Type itemType = type.GetGenericArguments()[0]; // use this...}通常,要支持any
IList<T>,您需要检查接口:
foreach (Type interfaceType in type.GetInterfaces()){ if (interfaceType.IsGenericType && interfaceType.GetGenericTypeDefinition() == typeof(IList<>)) { Type itemType = type.GetGenericArguments()[0]; // do something... break; }}

![C#通用列表 如何获得T的类型?[重复] C#通用列表 如何获得T的类型?[重复]](http://www.mshxw.com/aiimages/31/483991.png)
