Пример #1
0
 private void BinaryExpressionWithMemberAccess(BinaryExpression eq)
 {
     _parsed.Add(NameAndValues.Create
                 (
                     name: MemberName((MemberExpression)eq.Left),
                     value: ExpressionValue.GetExpressionValue(eq.Right)
                 ));
 }
Пример #2
0
        private void UnaryResultExpression(MethodCallExpression expr, LambdaExpression lambda)
        {
            var    memberAccess = (MemberExpression)expr.Arguments.First();
            object value;

            if (lambda.ReturnType != null && lambda.ReturnType != typeof(void))
            {
                value = lambda.Compile().DynamicInvoke(_object);
            }
            else
            {
                var memberValue = GetMemberValue(memberAccess);
                var paramValue  = expr.Arguments.Skip(1).Select(arg => ExpressionValue.GetExpressionValue(arg)).ToArray();
                value = ApplyOperation.Apply(expr, memberValue, paramValue);
            }
            _parsed.Add(NameAndValues.Create
                        (
                            name: memberAccess.Member.Name,
                            value: value
                        ));
        }