question about System.Reflection
I have a COM object (which I did not create), and when I use the method Type.GetProperties(), it returns an array of PropertyInfo, but the thing is, it is returning a bunch of properties that don't usually show up through intellisense when accessing the properties directly (ie. comObject->property1). Is there a way to make it so that the only PropertyInfo that is returned are the ones that I see in when using intellisense? I've tried doing this:
Code:
Type.GetProperties(BindingFlags.Public)
But it ends up returning 0 properties. Any ideas? Thanks.
Re: question about System.Reflection
You should play around with various combinations of BindingFlags values. You can combine them with a bitwise Or.
Re: question about System.Reflection
You'll need to determine whether you want instance methods include and/or static methods included. Since you've specific neither, you won't be getting any results. So, like John mentioned, you'll have to take a look at the BindingFlags that you want. It is quite likely that you'll want the Instance flag combined with your Public flag. Your flags would look like this:
Code:
BindingFlags flags = BindingFlags.Public |
BindingFlags.Instance;
// = 0001 0100
// = 20
The Type.GetProperties method you used will return all public instance or static methods.