我需要使用反射来检索 可空日期时间类型
的属性值。
我该如何做?
当我尝试使用 propertyInfo.GetValue(object, null)
时它不起作用。
谢谢
我的代码:
var propertyInfos = myClass.GetType().GetProperties();
foreach (PropertyInfo propertyInfo in propertyInfos)
{
object propertyValue= propertyInfo.GetValue(myClass, null);
}
可空类型的propertyValue结果始终为null