// </summary> /// <param name="var_name"></param> /// <param name="exp"></param> /// <returns>return string</returns> public static string GetVarName<T>(this T var_name, System.Linq.Expressions.Expression<Func<T, T>> exp) { return ((System.Linq.Expressions.MemberExpression)exp.Body).Member.Name; }
原文地址:http://www.cnblogs.com/gongy/p/lm-2015-04-03.html