Reflection - PropertyInfo

  • Thread starter Thread starter Zanna
  • Start date Start date
Z

Zanna

Hi all!

A little question on System.Reflection.

I know that with the MethodInfo I can get if a method is public or private.

But for properties?
PropertyInfo does not contain a IsPublic property!

How can I get this information for a property?

Thanx
 
Zanna said:
A little question on System.Reflection.

I know that with the MethodInfo I can get if a method is public or private.

But for properties?
PropertyInfo does not contain a IsPublic property!

How can I get this information for a property?

Retrieve each of the methods associated with the property and find out
if it's public or not. Note that in the next version of .NET properties
will be able to have (say) a public accessor and a private mutator.
 
Jon Skeet said:
Retrieve each of the methods associated with the property and find out
if it's public or not.

I don't understand how can I say if a property is public using this.
Can you do an example?

If a method is public for a property you cannot say if the property itself
is public or not (always if the property has methods to explore).

Thanx
 
Zanna said:
I don't understand how can I say if a property is public using this.
Can you do an example?

If a method is public for a property you cannot say if the property itself
is public or not (always if the property has methods to explore).

Not at all sure by what you meant by the bits in brackets, but I
believe a property really *is* effectively public if and only if it has
a public accessor or mutator. Can you give an example where this isn't
true?
 
Back
Top