My code is returning a blank array of PropertyInfo
PropertyInfo[] classProperties = typeof(Processor).GetProperties();
All properties in this class are public.
Using .NET 2.0 Framework.
I have also tried using an instance declared earlier in my code:
PropertyInfo[] classProperties = Computer.Processor[0].GetType().GetProperties();
And I have tried using bindings such as Default, Instance and Public.
Any ideas?
The parameterless form will return public properties. So there are 2 likely options:
A public property is something a: with the
publicmodifier, and b: with agetorsetaccessor, for example either of:Note also that interface-bound properties that are implemented as explicit interface implementation will only be reflected if you query against the interface, not the class; so the following will not show unless you start from
typeof(ISomeInterface):