新文章 网摘 文章 随笔 日记

.NET - 获取反射的 PropertyInfo 的默认值

object defaultValue = type.IsValueType ? Activator.CreateInstance(type) : null;

 

https://stackoverflow.com/questions/407337/net-get-default-value-for-a-reflected-propertyinfo
posted @ 2021-06-07 15:48  岭南春  阅读(167)  评论(0)    收藏  举报