Expression.NewArrayBounds Metoda

Definice

Vytvoří objekt NewArrayExpression , který představuje vytvoření pole se zadaným pořadím.

Přetížení

NewArrayBounds(Type, Expression[])

Vytvoří objekt NewArrayExpression , který představuje vytvoření pole se zadaným pořadím.

NewArrayBounds(Type, IEnumerable<Expression>)

Vytvoří objekt NewArrayExpression , který představuje vytvoření pole se zadaným pořadím.

NewArrayBounds(Type, Expression[])

Zdroj:
NewArrayExpression.cs
Zdroj:
NewArrayExpression.cs
Zdroj:
NewArrayExpression.cs

Vytvoří objekt NewArrayExpression , který představuje vytvoření pole se zadaným pořadím.

public:
 static System::Linq::Expressions::NewArrayExpression ^ NewArrayBounds(Type ^ type, ... cli::array <System::Linq::Expressions::Expression ^> ^ bounds);
public static System.Linq.Expressions.NewArrayExpression NewArrayBounds (Type type, params System.Linq.Expressions.Expression[] bounds);
static member NewArrayBounds : Type * System.Linq.Expressions.Expression[] -> System.Linq.Expressions.NewArrayExpression
Public Shared Function NewArrayBounds (type As Type, ParamArray bounds As Expression()) As NewArrayExpression

Parametry

type
Type

A Type , který představuje typ prvku pole.

bounds
Expression[]

Pole Expression objektů, které se mají použít k naplnění Expressions kolekce.

Návraty

Vlastnost NewArrayExpression má rovnou NodeTypeNewArrayBounds a Expressions vlastnost nastavenou na zadanou hodnotu.

Výjimky

type nebo bounds je null.

-nebo-

Prvek je boundsnull.

Vlastnost Type prvku bounds nepředstavuje celočíselný typ.

Příklady

Následující příklad ukazuje, jak použít metodu NewArrayBounds k vytvoření stromu výrazů, který představuje vytvoření pole řetězců s pořadím 2.

// Create an expression tree that represents creating a
// two-dimensional array of type string with bounds [3,2].
System.Linq.Expressions.NewArrayExpression newArrayExpression =
    System.Linq.Expressions.Expression.NewArrayBounds(
            typeof(string),
            System.Linq.Expressions.Expression.Constant(3),
            System.Linq.Expressions.Expression.Constant(2));

// Output the string representation of the Expression.
Console.WriteLine(newArrayExpression.ToString());

// This code produces the following output:
//
// new System.String[,](3, 2)
' Create an expression tree that represents creating a string
' array with rank 2 and bounds (3,2).
Dim newArrayExpression As System.Linq.Expressions.NewArrayExpression = _
    System.Linq.Expressions.Expression.NewArrayBounds( _
            Type.GetType("System.String"), _
            System.Linq.Expressions.Expression.Constant(3), _
            System.Linq.Expressions.Expression.Constant(2))

' Output the string representation of the Expression.
Console.WriteLine(newArrayExpression.ToString())

' This code produces the following output:
'
' new System.String[,](3, 2)

Poznámky

Vlastnost Type výsledného NewArrayExpression představuje typ pole, jehož pořadí se rovná délce bounds a jehož typ prvku je type.

Vlastnost Type každého prvku bounds musí představovat celočíselný typ.

Platí pro

NewArrayBounds(Type, IEnumerable<Expression>)

Zdroj:
NewArrayExpression.cs
Zdroj:
NewArrayExpression.cs
Zdroj:
NewArrayExpression.cs

Vytvoří objekt NewArrayExpression , který představuje vytvoření pole se zadaným pořadím.

public:
 static System::Linq::Expressions::NewArrayExpression ^ NewArrayBounds(Type ^ type, System::Collections::Generic::IEnumerable<System::Linq::Expressions::Expression ^> ^ bounds);
public static System.Linq.Expressions.NewArrayExpression NewArrayBounds (Type type, System.Collections.Generic.IEnumerable<System.Linq.Expressions.Expression> bounds);
static member NewArrayBounds : Type * seq<System.Linq.Expressions.Expression> -> System.Linq.Expressions.NewArrayExpression
Public Shared Function NewArrayBounds (type As Type, bounds As IEnumerable(Of Expression)) As NewArrayExpression

Parametry

type
Type

A Type , který představuje typ prvku pole.

bounds
IEnumerable<Expression>

Objekt IEnumerable<T> obsahující objekty, které Expression se mají použít k naplnění Expressions kolekce.

Návraty

Vlastnost NewArrayExpression má rovnou NodeTypeNewArrayBounds a Expressions vlastnost nastavenou na zadanou hodnotu.

Výjimky

type nebo bounds je null.

-nebo-

Prvek je boundsnull.

Vlastnost Type prvku bounds nepředstavuje celočíselný typ.

Příklady

Následující příklad ukazuje, jak použít metodu NewArrayBounds k vytvoření stromu výrazů, který představuje vytvoření pole řetězců s pořadím 2.

// Create an expression tree that represents creating a
// two-dimensional array of type string with bounds [3,2].
System.Linq.Expressions.NewArrayExpression newArrayExpression =
    System.Linq.Expressions.Expression.NewArrayBounds(
            typeof(string),
            System.Linq.Expressions.Expression.Constant(3),
            System.Linq.Expressions.Expression.Constant(2));

// Output the string representation of the Expression.
Console.WriteLine(newArrayExpression.ToString());

// This code produces the following output:
//
// new System.String[,](3, 2)
' Create an expression tree that represents creating a string
' array with rank 2 and bounds (3,2).
Dim newArrayExpression As System.Linq.Expressions.NewArrayExpression = _
    System.Linq.Expressions.Expression.NewArrayBounds( _
            Type.GetType("System.String"), _
            System.Linq.Expressions.Expression.Constant(3), _
            System.Linq.Expressions.Expression.Constant(2))

' Output the string representation of the Expression.
Console.WriteLine(newArrayExpression.ToString())

' This code produces the following output:
'
' new System.String[,](3, 2)

Poznámky

Vlastnost Type výsledného NewArrayExpression představuje typ pole, jehož pořadí se rovná délce bounds a jehož typ prvku je type.

Vlastnost Type každého prvku bounds musí představovat celočíselný typ.

Platí pro