Hi,
To get the properties is not big deal, but I don´t want to get the properties inherited from another class. The bindingFlags
option doesn´t have any option of this kind.
Is that possible ?
cheers
Hi,
To get the properties is not big deal, but I don´t want to get the properties inherited from another class. The bindingFlags
option doesn´t have any option of this kind.
Is that possible ?
cheers
Use BindingFlags.DeclaredOnly with your Type.GetProperties call in order to specify to just get the properties from the specified type.
For example, to get all non-static properties on a type without looking up it's hierarchy, you could do:
var properties = theType.GetProperties(
BindingFlags.Public |
BindingFlags.NonPublic |
BindingFlags.Instance |
BindingFlags.DeclaredOnly);