Lately I have been using reflection to work in my project, and I have the current 开发者_开发百科question.
While in Type.GetProperties(Flags)
, we can filter the properties we get using 'Flags'; in TypeDescriptor.GetProperties()
, we don't.
In type.GetProperties
I can filter to get only properties not inherited.
Is it possible to do the same with TypeDescriptor.GetProperties()
(only properties not inherited)?
Thank you
No, you can't.
The TypeDescriptor.GetProperties()
is used to get PropertyDescriptor
instances with possibility to filter using specific Attribute
s.
The Type.GetProperties()
is used to get PropertyInfo
instances with possibility to filter using specific BindingFlags
.
精彩评论