473,324 Members | 2,511 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,324 software developers and data experts.

Get class information

Hi

I create a struct, or a class and I'd like to know
which are the members available.. by code

something like

pubic class nico
{
public int age;
public int old;
}

and somewhere , i could do something like this
foreach(Members member in nico.Members)
{
member.Value = i;
}

See what I mean ?

Where should I start looking for ?

Nicolas, Toulouse
Jan 13 '06 #1
2 1685
nicolas ETIENNE wrote:
Hi

I create a struct, or a class and I'd like to know
which are the members available.. by code

something like

pubic class nico
{
public int age;
public int old;
}

and somewhere , i could do something like this
foreach(Members member in nico.Members)
{
member.Value = i;
}

See what I mean ?

Where should I start looking for ?


Nico n = new Nico();
PropertyCollection properties = TypeDescriptor.GetProperties(n);

these types are in the System.ComponentModel namespace.
:)

FB

--
------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
Jan 13 '06 #2
nicolas ETIENNE wrote:
I create a struct, or a class and I'd like to know
which are the members available.. by code
<snip>
Where should I start looking for ?


You should look in the System.Reflection namespace, and at
Type.GetProperties, Type.GetFields etc.

Jon

Jan 13 '06 #3

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

Similar topics

6
by: E G | last post by:
Hi! I am having problems in designing a class. First, I have a base class that allocates a 3D data set and allows some other mathematical operations with it, something like this: template...
42
by: Dan | last post by:
Hello, I have trouble with class calling. I am calling getvolume() with succes in the function CreateCircle but it do not want to call it in ShowCircle() function. I am staying in the same...
6
by: surrealtrauma | last post by:
i have a trouble about that: i want to ask user to enter the employee data (employee no., name, worked hour, etc.), but i dont know how to sort the data related to a particular employee as a...
3
by: Noozer | last post by:
I have several tags on a webpage of the same class. If the user clicks a specific checkbox I'd like to be able to alter the display property of the class, affecting all objects of that class. ...
10
by: Ray Z | last post by:
hi, there I build a Class Library, I write a class A to implement interface IA. The problem is when I give the dll file to others, thet can get all information about not only IA, but also A. They...
9
by: thomson | last post by:
Hi all, Would you please explain me where will be the heap stored if it is declared inside the Class, As class is a reference type, so it gets stored on the heap, but struct is a value...
7
by: Göran Tänzer | last post by:
Hi, i've written a class which does some calculations for my web application. These informatinos are different for each page request - the current user is not important. i have about 10 aspx...
6
by: Orgun | last post by:
Hi, I sent this message to the moderated c++ group too but it is waiting for moderator approval and I wanted to send here too. I am new to Design Patterns. I want to write a simple...
4
by: Mike | last post by:
Class A public objX I want to create 2 or more instances of Class A and have the same value for objX in all instances. Instance1 of Class A Instance2 of Class A Instance3 of Class A
4
by: Joseph Geretz | last post by:
We use a Soap Header to pass a token class (m_Token) back and forth with authenticated session information. Given the following implementation for our Logout method, I vastly prefer to simply code...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.