Link to home
Start Free TrialLog in
Avatar of gromul
gromul

asked on

How to get variable name as string

How do I get variable names in a class as strings through reflection? I know that local variables will be renamed but it should be possible for non-locals.

Thanks
Avatar of multithreading
multithreading

foreach(FieldInfo field in myType.GetType().GetFields()) Console.WriteLine(field.Name);
SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial