c# 获得变量名称
string GetVariableName<T>(Expression<Func<T>> expr)
{
var body = (MemberExpression)expr.Body;
return body.Member.Name;
}
//调用
GetVariableName(() => qtck_nMax)
string GetVariableName<T>(Expression<Func<T>> expr)
{
var body = (MemberExpression)expr.Body;
return body.Member.Name;
}
//调用
GetVariableName(() => qtck_nMax)