Finding the variable name passed to a function

前端 未结 17 2153
广开言路
广开言路 2020-11-22 04:11

Let me use the following example to explain my question:

public string ExampleFunction(string Variable) {
    return something;
}

string WhatIsMyName = "         


        
17条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-22 05:04

    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 NamedParameter with attributes Name and Param. You then pass this object around as parameters.

提交回复
热议问题