Data/CafeLib.Data/Cache/PropertyExpressionList.cs
/// <summary>
/// Get the property name in the lambda expression.
/// </summary>
/// <param name="lambda"></param>
/// <returns></returns>
Get the property name in the lambda expression.
Get the property name in the lambda expression .
private static string GetMemberName(LambdaExpression lambda)
        {
            Expression expr = lambda;
            while (true)
            {
                switch (expr.NodeType)
                {
                    case ExpressionType.Lambda:
                        expr = ((LambdaExpression)expr).Body;
                        break;
                    case ExpressionType.Convert:
                        expr = ((UnaryExpression)expr).Operand;
                        break;
                    case ExpressionType.MemberAccess:
                        var memberExpression = (MemberExpression)expr;
                        return memberExpression.Member.Name;
                }
            }
        }
private static string GetMemberName ( LambdaExpression lambda ) { Expression expr = lambda ; while ( true ) { switch ( expr . NodeType ) { case ExpressionType . Lambda : expr = ( ( LambdaExpression ) expr ) . Body ; break ; case ExpressionType . Convert : expr = ( ( UnaryExpression ) expr ) . Operand ; break ; case ExpressionType . MemberAccess : var memberExpression = ( MemberExpression ) expr ; return memberExpression . Member . Name ; } } }
Get the property name in the lambda expression.
Get the property name in the lambda expression .
None
lambda
LambdaExpression
None