I have got a class which contains more then 150 fields. i need the name of fields (not value) in an array.
because its very hard and not a good approach to write 150 fields name (which can be incremented or decremented in count according to requirement change) manually in code.
i need help to get loop through names for field or get list of field names in a array so that i can loop over it and use it in code. i am using visual studio 2008
Thanks
try
This work for me perfectly ExampleClass is class You need list all fields
for all public + nonpublic instance fields:
or in VS2005 (comments):
Try this:
Worked for me
// t for Type