Example #1
0
        public static Expression BinaryOp(Expression lhs, Expression rhs, ExpressionType expressionType)
        {
            var expArgs = new List <Expression>()
            {
                lhs, rhs
            };
            var binderM = Binder.BinaryOperation(CSharpBinderFlags.None, expressionType, lhs.Type, new []
            {
                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
            });

            return(Expression.Dynamic(binderM, typeof(object), expArgs));
        }
Example #2
0
        private static Expression DynamicBinaryOperatorFunc(Expression le, Expression re, ExpressionType expressionType)
        {
            var expArgs = new List <Expression>()
            {
                le, re
            };


            var binderM = Binder.BinaryOperation(CSharpBinderFlags.None, expressionType, le.Type, new CSharpArgumentInfo[]
            {
                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null),
                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null)
            });

            return(Expression.Dynamic(binderM, typeof(object), expArgs));
        }
 internal static CallSiteBinder GetBinaryBinder(TokenType tokenType)
 {
     return(Binder.BinaryOperation(CSharpBinderFlags.CheckedContext, GetExpressionType(tokenType), null, GetArgInfo(2)));
 }