示例#1
0
 //
 // Summary:
 //     Visits the children of the System.Linq.Expressions.DynamicExpression.
 //
 // Parameters:
 //   node:
 //     The expression to visit.
 //
 // Returns:
 //     The modified expression, if it or any subexpression was modified; otherwise,
 //     returns the original expression.
 protected override Expression VisitDynamic(DynamicExpression node)
 {
     Console.WriteLine("VisitDynamic:");
     Console.WriteLine('\t' + node.GetType().ToString());
     Console.WriteLine('\t' + node.ToString());
     return(base.VisitDynamic(node));
 }
示例#2
0
        public void TypedAritySpecialisedUsedWhenPossible(int size, string nameSuffix)
        {
            CallSiteBinder binder = Binder.GetMember(
                CSharpBinderFlags.None, "Member", GetType(),
                new[] { CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, null) });
            Type delType = Expression.GetFuncType(
                Enumerable.Repeat(typeof(object), size).Append(typeof(string)).Prepend(typeof(CallSite)).ToArray());
            DynamicExpression exp = DynamicExpression.MakeDynamic(
                delType, binder, Enumerable.Range(0, size).Select(_ => Expression.Constant(null)));

            Assert.Equal("TypedDynamicExpression" + nameSuffix, exp.GetType().Name);
            exp = Expression.MakeDynamic(
                delType, binder, Enumerable.Range(0, size).Select(_ => Expression.Constant(null)));
            Assert.Equal("TypedDynamicExpression" + nameSuffix, exp.GetType().Name);
            if (size != 0)
            {
                exp = Expression.Dynamic(
                    binder, typeof(string), Enumerable.Range(0, size).Select(_ => Expression.Constant(null)));
                Assert.Equal("TypedDynamicExpression" + nameSuffix, exp.GetType().Name);
            }
        }
示例#3
0
 protected override Expression VisitDynamic(DynamicExpression node)
 {
     throw new NotSupportedException(node.GetType().Name);
 }
 /// <param name="node">The expression to visit.</param>
 /// <returns>The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.</returns>
 protected override Expression VisitDynamic(DynamicExpression node)
 {
     throw new NotSupportedException(string.Format(Resources.EX_PROCESS_NODE_NOT_SUPPORT, node.GetType().Name));
 }