473,385 Members | 1,337 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Reflection - PropertyInfo

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

--
Math Parser : http://www.neodatatype.net

Nov 15 '05 #1
3 5796
Zanna <zn*******@virgilio.it> wrote:
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 - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #2
"Jon Skeet" <sk***@pobox.com> wrote in message
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.


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

--
Math Parser : http://www.neodatatype.net
Nov 15 '05 #3
Zanna <zn*******@virgilio.it> wrote:
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.


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?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet/
If replying to the group, please do not mail me too
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nigel Sampson | last post by:
ey all, I'm in the process of creating a method of tracking whenever an objects properties are changed. Since its not possible to alter existing types I decided to used a proxy generated using...
6
by: Lars Nielsen | last post by:
Hi everybody, I've run into a problem when using the reflection assembly on COM objects and been browsing around the net for some while. Apparently a few has asked the same question though no...
4
by: Frank Rizzo | last post by:
Ok, I've heard all about reflection. How do I print out the results for all the properties on this object: System.Reflection.Assembly.GetExecutingAssembly().GetName() I don't want a list of...
10
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a...
3
by: Roger Webb | last post by:
Hey, I'm attempting to use reflection in order to get the types of properties in a class. However, I seem to be having trouble determining exactly which type I am getting. In the foreach of...
2
by: Marc | last post by:
Given a class 'Invoice' with a property 'public IMyColl<IInvoiceLine> InvoiceLines' where 'IMyColl<T> : IList<T>' i would like to detect by reflection that 'InvoiceLines' is a...
11
by: Aaron Queenan | last post by:
Given the classes: class Class { public static implicit operator int(Class c) { return 0; } } class Holder
3
by: Oskar Lundgren | last post by:
I want to iterate over fields declared like this, using reflection (and there are good reasons for that): Protected WithEvents Foo1 As Bar Protected WithEvents Foo2 As Bar .... I use the...
4
by: Lucas Tam | last post by:
Hi all, I need to set a property on a subclass such as: Report.ExportOptions.ExportFormatType = ExportFormatType.Excel AND Report.ExportOptions.FormatOptions = excelFormatOpts
15
by: satankidneypie | last post by:
Hi, I'm going to start this off with some code as it'll make it easier to explain afterwards... using System; namespace ConsoleApplication1 { /// <summary>
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.