c# - Finding the variable name passed to a function -
let me use following example explain question:
public string examplefunction(string variable) { return something; } string whatismyname = "hello world"'; string hello = examplefunction(whatismyname);
when pass variable "whatismyname" example function, want able string of original variables name. perhaps like:
variable.originalname.tostring()
is there way this?
**no.**i don't think so.
the variable name use convenience , readability. compiler doesn't need & chucks out if i'm not mistaken.
if helps, define new class called namedparameter attributes name , param. pass object around parameters.
Comments
Post a Comment