Expression.NewArrayBounds Metoda

Definicja

Tworzy obiekt NewArrayExpression reprezentujący tworzenie tablicy, która ma określoną rangę.

Przeciążenia

NewArrayBounds(Type, Expression[])

Tworzy obiekt NewArrayExpression reprezentujący tworzenie tablicy, która ma określoną rangę.

NewArrayBounds(Type, IEnumerable<Expression>)

Tworzy obiekt NewArrayExpression reprezentujący tworzenie tablicy, która ma określoną rangę.

NewArrayBounds(Type, Expression[])

Źródło:
NewArrayExpression.cs
Źródło:
NewArrayExpression.cs
Źródło:
NewArrayExpression.cs

Tworzy obiekt NewArrayExpression reprezentujący tworzenie tablicy, która ma określoną rangę.

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

Obiekt Type reprezentujący typ elementu tablicy.

bounds
Expression[]

Tablica Expression obiektów do użycia w celu wypełnienia kolekcji Expressions .

Zwraca

WłaściwośćNewArrayExpression, która ma właściwość równą NewArrayBoundsNodeType i Expressions właściwość ustawioną na określoną wartość.

Wyjątki

type lub bounds ma wartość null.

-lub-

Element elementu bounds to null.

Type Właściwość elementu bounds elementu nie reprezentuje typu całkowitego.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą NewArrayBounds metody utworzyć drzewo wyrażeń reprezentujące tworzenie tablicy ciągów, która ma rangę 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)

Uwagi

Właściwość Type wynikowego NewArrayExpression reprezentuje typ tablicy, którego ranga jest równa długości bounds i którego typ elementu to type.

Właściwość Type każdego elementu bounds musi reprezentować typ całkowity.

Dotyczy

NewArrayBounds(Type, IEnumerable<Expression>)

Źródło:
NewArrayExpression.cs
Źródło:
NewArrayExpression.cs
Źródło:
NewArrayExpression.cs

Tworzy obiekt NewArrayExpression reprezentujący tworzenie tablicy, która ma określoną rangę.

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

Obiekt Type reprezentujący typ elementu tablicy.

bounds
IEnumerable<Expression>

Obiekt IEnumerable<T> zawierający Expression obiekty używane do wypełniania kolekcji Expressions .

Zwraca

WłaściwośćNewArrayExpression, która ma właściwość równą NewArrayBoundsNodeType i Expressions właściwość ustawioną na określoną wartość.

Wyjątki

type lub bounds ma wartość null.

-lub-

Element elementu bounds to null.

Type Właściwość elementu bounds elementu nie reprezentuje typu całkowitego.

Przykłady

W poniższym przykładzie pokazano, jak za pomocą NewArrayBounds metody utworzyć drzewo wyrażeń reprezentujące tworzenie tablicy ciągów, która ma rangę 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)

Uwagi

Właściwość Type wynikowego NewArrayExpression reprezentuje typ tablicy, którego ranga jest równa długości bounds i którego typ elementu to type.

Właściwość Type każdego elementu bounds musi reprezentować typ całkowity.

Dotyczy