【发布时间】:2013-08-17 16:20:37
【问题描述】:
如何从 DataRow 的 PropertyDescriptor 获取 PropertyInfo。
//pd is a PropertyDescriptor
var propertyinfo = pd.ComponentType.GetProperty(pd.Name);
上述代码适用于列表集合,但在使用 DataTable 时无法正常工作。
对此有什么想法吗?
【问题讨论】:
-
你以后用
propertyInfo做什么?我猜想得到财产的价值,但还有什么? -
这样我需要获取 CustomAttributes..
-
好的,当与
DataTable合作时,pd.ComponentType会给您带来什么? -
它为 DataTable 返回 null.. ComponentType 是 DataRowView 的类型..
标签: c# datatable propertyinfo propertydescriptor