getproperties

How do you get the all properties of a class and its base classes (up the hierarchy) with Reflection? (C#)

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...

Reflection - setting Type of returned obj?

I am populating different types objects with datarows with each attrivute of the relevant object = to the similiarly name field in the datarow. I'd like to use a generic function to do this. How do I force the Type of the return object from the generic function. I don't yet know what the <T> syntax actually means: PopulateObject<T> doe...

Reflection - getting properties of nested objects

refers to : http://stackoverflow.com/questions/906327/reflection-setting-type-of-returned-obj I have a object Call Jobcard with a few properties, one of which is another object called Customer with its own properties, one of which is another nested object called Adress. These 2 functions will be handling other object types as well. pr...

When using reflection to get at properties, How can I limit my search to just the subclass I'm interested in?

After successfully getting a list of specific types out of an assembly using reflection, I now want to get at the public properties of each of those. Each of these types derives from at least one base class. I notice when I get properties on a type that I get properties from the base classes as well. I need a way to filter out base c...

Dynamically change properties returned by ICustomTypeDescriptor.GetProperties to readonly

I have a class which implements ICustomTypeDescriptor, and is viewed and edited by the user in a PropertyGrid. My class also has a IsReadOnly property which determines if the user will be able to save their changes later. I don't want to allow the user to make changes if they will not be able to save. So if IsReadOnly is true I want to o...

IEnumerable.GetProperties()

I have class Foo, which derived from interface IFoo and IEnumerable public class Foo:IFoo,IEnumerable { public decimal Count {...} ///etc... } How to call GetProperties(), that it's return only public properties of IEnumerable (not IFoo or this class)? ...