【发布时间】:2012-12-28 05:40:32
【问题描述】:
我有这个功能。
public void AddVariable( String str)
{
Response.Write(str); // will write the value of str
}
但我需要写下传递给函数的字符串变量的名称。
例如:
String temp = "test Variable";
AddVariable(temp);
这里我需要在我的函数中获取变量的name,而不是value。
即,我需要在我的函数中获取“temp”,而不是“test Variable”。
有可能吗?
【问题讨论】:
-
@rs,我试过那个答案,但我只能得到变量名'str',而不是我传入的那个
-
@AkhilSekharan :看到这篇文章stackoverflow.com/questions/214086/…
-
@pRosper K,返回的是参数名称,不是我传入的字符串名称。:(