Let me use the following example to explain my question:
public string ExampleFunction(string Variable) { return something; } string WhatIsMyName = "Hello World"; string Hello = ExampleFunction(WhatIsMyName);
When I pass the variable WhatIsMyName to the ExampleFunction, I want to be able to get a string of the original variable’s name. Perhaps something like:
Variable.OriginalName.ToString() // == "WhatIsMyName"
Is there any way to do this?
No. I don’t think so.
The variable name that you use is for your convenience and readability. The compiler doesn’t need it & just chucks it out if I’m not mistaken.
If it helps, you could define a new class called
NamedParameterwith attributesNameandParam. You then pass this object around as parameters.