为了账号安全,请及时绑定邮箱和手机立即绑定

propertyInfo.PropertyType 和 propertyInfo.GetType

propertyInfo.PropertyType 和 propertyInfo.GetType

C#
MMMHUHU 2022-11-22 16:27:10
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;请给我一些想法。谢谢你。
查看完整描述

1 回答

?
POPMUISE

TA贡献1765条经验 获得超5个赞

嗯,propertyInfo.PropertyTypepropertyInfo对象所代表的属性的类型。这是typeof(List<string>)你的情况。另一方面,propertyInfo.GetType()是从 派生的类型 typeof(PropertyInfo)



查看完整回答
反对 回复 2022-11-22
  • 1 回答
  • 0 关注
  • 206 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号