So what I have right now is something like this:
PropertyInfo[] info = obj.GetType().GetProperties(BindingFlags.Public);
where obj is some object.
The problem is some of the properties I want aren’t in obj.GetType() they’re in one of the base classes further up. If I stop the debugger and look at obj, the I have to dig through a few ‘base’ entries to see the properties I want to get at. Is there some binding flag I can set to have it return those or do I have to recursively dig through the Type.BaseType hierarchy and do GetProperties on all of them?
Use this:
EDIT: Of course the correct answer is that of Jay.
GetProperties()without parameters is equivalent toGetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static ). TheBindingFlags.FlattenHierarchyplays no role here.