473,408 Members | 1,960 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,408 software developers and data experts.

List all public properties of a Class ?

Hi all,

Is there any way to get a list of all the Public properties of a Class
?

Something like the GetNames() function returns a list of all the items
in an Enumeration.

As a simple example, let's take the SystemIcons Class. Say, I want to
get a list of all it's Public Properties.

Thanks in advance,

Regards,

Cerebrus.

Feb 26 '06 #1
5 3191
CMM
Look at System.Reflection
http://msdn.microsoft.com/library/de...reflection.asp

--
-C. Moya
www.cmoya.com

"Cerebrus" <zo*****@sify.com> wrote in message
news:11**********************@j33g2000cwa.googlegr oups.com...
Hi all,

Is there any way to get a list of all the Public properties of a Class
?

Something like the GetNames() function returns a list of all the items
in an Enumeration.

As a simple example, let's take the SystemIcons Class. Say, I want to
get a list of all it's Public Properties.

Thanks in advance,

Regards,

Cerebrus.

Feb 26 '06 #2
Err... could you perhaps point me to a tutorial or an example on the
subject.

I'm a bit weak on the subject of Reflection ! ;-)

Regards,

Cerebrus.

Feb 26 '06 #3
Cerebrus,

Did you already look at the objectbrowser, View-> ObjectBrowser and look in
the (standard) right pane.

I hope this helps

Cor
Feb 26 '06 #4
I think I got the answer to my original question : (For the benefit of
anyone who doesn't know)

Dim myType As Type = GetType(System.Drawing.SystemIcons)
Dim myProps() As PropertyInfo =
myType.GetProperties(BindingFlags.Public Or BindingFlags.Static)
Dim myProp As PropertyInfo
For Each myProp In myProps
Console.WriteLine("Name: {0}, Type: {1}", myProp.Name,
myProp.PropertyType)
Next

Regards,

Cerebrus.

Feb 26 '06 #5
"Cerebrus" <zo*****@sify.com> schrieb:
Is there any way to get a list of all the Public properties of a Class
?

Something like the GetNames() function returns a list of all the items
in an Enumeration.

As a simple example, let's take the SystemIcons Class. Say, I want to
get a list of all it's Public Properties.


<URL:http://groups.google.de/group/microsoft.public.dotnet.languages.vb/msg/ac8f8da74ab352f4>

Note the 'BindingFlags'. In order to get the shared properties you need to
specify 'BindingFlags.Static' instead of 'BindingFlags.Instance'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Feb 26 '06 #6

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

Similar topics

0
by: Jef Driesen | last post by:
I need some help to implement the adjacency list representation of a (undirected) graph. The data structure I need is something like the picture on the website...
7
by: Raymond Lewallen | last post by:
Want to know if/how to get a list of properties that are available in a class and store the properties names in an arraylist. TIA, Raymond Lewallen
9
by: zacks | last post by:
I have written a serialized class that has several properties that are typed as a list of type class. When I deserialize an XML file, the list is populated just fine. But I am having trouble...
5
by: David Longnecker | last post by:
I'm working to create a base framework for our organization for web and client-side applications. The framework interfaces with several of our systems and provides the business and data layer...
11
by: dave18 | last post by:
Hello all! I found a solution to my original question, but there's still so much I don't understand about it, I thought I'd give this forum a try. At the very least, maybe it will help someone...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.