Get class information

  • Thread starter Thread starter nicolas ETIENNE
  • Start date Start date
N

nicolas ETIENNE

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
 
nicolas said:
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

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

Where should I start looking for ?

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

Jon
 
Back
Top