Finding the variable name passed to a function

前端 未结 17 2155
广开言路
广开言路 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 04:44

    No. A reference to your string variable gets passed to the funcion--there isn't any inherent metadeta about it included. Even reflection wouldn't get you out of the woods here--working backwards from a single reference type doesn't get you enough info to do what you need to do.

    Better go back to the drawing board on this one!

    rp

提交回复
热议问题