0

Possible Duplicate:
Finding the Variable Name passed to a Function in C#
get name of a variable or parameter

It's sorta a long explanation, so I'll just dive right into the question:

Is there any way to store the name of the variable used in a parameter to a string?

example:

 void ExampleMethod(int parameter1)
{
Stuff
}

ExampleMethod(VariableInt);

How would I go about getting "VariableInt" into a string variable?

Community
  • 1
  • 1
MikkelT
  • 633
  • 1
  • 10
  • 16
  • Could you explain why do you need that? – svick Feb 05 '13 at 01:04
  • Put quotes around it? The `CompilerServices` namespace has a bunch of things like this but none for getting the local variable a parameter was assigned from. – millimoose Feb 05 '13 at 01:04
  • here is a link for you that will help you good luck http://abdullin.com/journal/2008/12/13/how-to-find-out-variable-or-parameter-name-in-c.html – MethodMan Feb 05 '13 at 01:07

0 Answers0