它在propertyInfo.PropertyType和propertyInfo.GetType()之间返回不同的数据。
我想知道这有什么不同
var propInfo = dataModel.GetProperty("List<string>");
var test1 = propinfo.GetType().IsGenericType; // it returns false;
var test2 = propinfo.PropertyType.IsGenericType; // it returns true;请告诉我一些想法。
谢谢。
发布于 2019-04-03 03:59:16
propertyInfo.PropertyType是propertyInfo对象表示的属性的类型。在你的情况下是typeof(List<string>)。另一方面,propertyInfo.GetType()是从typeof(PropertyInfo)派生的一种类型。
https://stackoverflow.com/questions/55485785
复制相似问题