/// /// Get the name of the provided member. /// Same as using the operatore nameof provided by C# >= 6.0. /// /// Usage: GetMemberName(() => myMember); /// /// /// /// private static string GetMemberName(Expression> memberExpression) { // Source: https://stackoverflow.com/a/9801735/1975002 // Note: with C# >= 6.0, the operator nameof could be used instead. MemberExpression expressionBody = (MemberExpression)memberExpression.Body; return expressionBody.Member.Name; }