how to find out the class information

  • Thread starter Thread starter Daniel
  • Start date Start date
D

Daniel

Hi,
I want to write a code to list all the members of one class, but i don't
know how to do that, any advice?

Thanks in advance.
 
The Type class provides you with that kind of information, although many of
the types that it uses are in the System.Reflection namespace. You can
retrieve the type of the instance through either GetType() or typeof(X),
where X is the name of your instance.

For example, GetFields() method on the Type instance returns a list of
FieldInfo instances, of each of which describe a field in the class (the
Name property, for example, provides the name of the field, while the
FieldType property provides the type of the field). There's also
GetMethods(), GetConstructors() and a few other methods.

Take a look...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top