Exemplo n.º 1
0
        public static MemberInfo Member(Expression exp)
        {
            MemberInfo prop    = null;
            var        visitor = new ExpressionVisitorV {
                VisitMember = e => { prop = e.Member; },
            };

            visitor.VisitUnary = e => visitor.Visit(e.Operand);
            visitor.Visit(exp);
            return(prop);
        }
Exemplo n.º 2
0
        public static string MemberName(Expression exp)
        {
            string r       = null;
            var    visitor = new ExpressionVisitorV {
                VisitMember     = e => { r = e.Member.Name; },
                VisitMethodCall = e => { r = e.Method.Name; },
            };

            visitor.VisitUnary = e => visitor.Visit(e.Operand);
            visitor.Visit(exp);
            return(r);
        }