I have an abstract class — let\'s name it Base
. This class contains some properties. Moreover, I have another class, inherited from class Base
— let\'s
Try this:
Type type = typeof(A);
PropertyInfo[] propInfos
= type.GetProperties(BindingFlags.Instance
| BindingFlags.Public
| BindingFlags.DeclaredOnly);
Invoking GetType()
on an object is only one of the ways of getting a Type
object. Another, which works even for abstract
classes, is typeof()
. Using the BindingFlags.DeclaredOnly
option with typeof(A).GetProperties
should do the trick.