How to get variable name using reflection?
- by Eran Betzalel
For example,
static void Main()
{
var someVar = 3;
Console.Write(GetVariableName(someVar));
}
The output of this program should be:
someVar
How can I achieve that using reflection?