System.Linq.Expressions.Expression.NewArrayInit C# (CSharp) Method

NewArrayInit() public static method

Creates a NewArrayExpression of the specified type from the provided initializers.
public static NewArrayInit ( Type type ) : NewArrayExpression
type Type A Type that represents the element type of the array.
return NewArrayExpression
        public static NewArrayExpression NewArrayInit(Type type, params Expression[] initializers)
        {
            return NewArrayInit(type, (IEnumerable<Expression>)initializers);
        }

Same methods

Expression::NewArrayInit ( Type type, IEnumerable initializers ) : NewArrayExpression

Usage Example

Ejemplo n.º 1
0
        public void NewArrayInit()
        {
            var expected = LinqExpression.NewArrayInit(typeof(long), LinqExpression.Constant(0L));

            using var g = new GraphEngine.Graph();
            g.LoadFromString(@"
@prefix : <http://example.com/> .

:s
    a :NewArrayInit ;
    :newArrayType [
        :typeName ""System.Int64"" ;
    ] ;
    :newArrayExpressions (
        [
            :constantValue 0 ;
        ]
    ) ;
.
");
            var s = g.GetUriNode(":s");

            var actual = Expression.Parse(s).LinqExpression;

            Console.WriteLine(actual.GetDebugView());

            actual.Should().Be(expected);
        }
All Usage Examples Of System.Linq.Expressions.Expression::NewArrayInit
Expression