/// <summary> /// Gets the name of the member. /// </summary> /// <param name="expression">The expresion.</param> /// <returns></returns> /// <exception cref="System.NotSupportedException">The specified expression does not represent a supported expression type</exception> public static string GetMemberName(UnaryExpression expression) { expression.Guard("expression"); var methodCallExpression = expression.Operand as MethodCallExpression; if (null != methodCallExpression) { return(methodCallExpression.Method.Name); } var memberExpression = expression.Operand as MemberExpression; if (null != memberExpression) { return(memberExpression.Member.Name); } throw new NotSupportedException("The specified expression does not represent a supported expression type"); }