Exemple #1
0
 //
 // Summary:
 //     Visits the children of the System.Linq.Expressions.BlockExpression.
 //
 // 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 VisitBlock(BlockExpression node)
 {
     Console.WriteLine("VisitBlock:");
     Console.WriteLine('\t' + node.GetType().ToString());
     Console.WriteLine('\t' + node.ToString());
     return(base.VisitBlock(node));
 }
        public void BlockFromEmptyParametersSameAsFromParams(object value, int blockSize)
        {
            ConstantExpression       constant    = Expression.Constant(value, value.GetType());
            IEnumerable <Expression> expressions = PadBlock(blockSize - 1, constant);

            BlockExpression fromParamsBlock = Expression.Block(SingleParameter, expressions.ToArray());
            BlockExpression fromEnumBlock   = Expression.Block(SingleParameter, expressions);

            Assert.Equal(fromParamsBlock.GetType(), fromEnumBlock.GetType());

            Assert.True(Expression.Lambda <Func <bool> >(Expression.Equal(constant, fromParamsBlock)).Compile()());
            Assert.True(Expression.Lambda <Func <bool> >(Expression.Equal(constant, fromEnumBlock)).Compile()());
        }
 protected override Expression VisitBlock(BlockExpression node)
 {
     throw new NotSupportedException(node.GetType().Name);
 }
Exemple #4
0
 protected override Expression VisitBlock(BlockExpression node)
 {
     throw new NotSupportedException($"Node type {node.GetType().Name} is not supported.");
 }
 /// <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 VisitBlock(BlockExpression node)
 {
     throw new NotSupportedException(string.Format(Resources.EX_PROCESS_NODE_NOT_SUPPORT, node.GetType().Name));
 }