Expression.NewArrayBounds Método

Definición

Crea un objeto NewArrayExpression que representa la creación de una matriz que tiene el rango especificado.

Sobrecargas

NewArrayBounds(Type, Expression[])

Crea un objeto NewArrayExpression que representa la creación de una matriz que tiene el rango especificado.

NewArrayBounds(Type, IEnumerable<Expression>)

Crea un objeto NewArrayExpression que representa la creación de una matriz que tiene el rango especificado.

NewArrayBounds(Type, Expression[])

Source:
NewArrayExpression.cs
Source:
NewArrayExpression.cs
Source:
NewArrayExpression.cs

Crea un objeto NewArrayExpression que representa la creación de una matriz que tiene el rango especificado.

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

Parámetros

type
Type

Type que representa el tipo de elemento de la matriz.

bounds
Expression[]

Matriz de objetos Expression que se va a usar para rellenar la colección de Expressions.

Devoluciones

NewArrayExpression cuya propiedad NodeType es NewArrayBounds y cuya propiedad Expressions se establece en el valor especificado.

Excepciones

type o bounds es null.

o bien

Un elemento de bounds es null.

La propiedad Type de un elemento de bounds no representa un tipo entero.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el NewArrayBounds método para crear un árbol de expresión que representa la creación de una matriz de cadenas que tiene un rango de 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)

Comentarios

La Type propiedad del resultante NewArrayExpression representa un tipo de matriz cuyo rango es igual a la longitud de y cuyo tipo de bounds elemento es type.

La Type propiedad de cada elemento de bounds debe representar un tipo entero.

Se aplica a

NewArrayBounds(Type, IEnumerable<Expression>)

Source:
NewArrayExpression.cs
Source:
NewArrayExpression.cs
Source:
NewArrayExpression.cs

Crea un objeto NewArrayExpression que representa la creación de una matriz que tiene el rango especificado.

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

Parámetros

type
Type

Type que representa el tipo de elemento de la matriz.

bounds
IEnumerable<Expression>

IEnumerable<T> que contiene los objetos Expression que se van a usar para rellenar la colección de Expressions.

Devoluciones

NewArrayExpression cuya propiedad NodeType es NewArrayBounds y cuya propiedad Expressions se establece en el valor especificado.

Excepciones

type o bounds es null.

o bien

Un elemento de bounds es null.

La propiedad Type de un elemento de bounds no representa un tipo entero.

Ejemplos

En el ejemplo siguiente se muestra cómo usar el NewArrayBounds método para crear un árbol de expresión que representa la creación de una matriz de cadenas que tiene un rango de 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)

Comentarios

La Type propiedad del resultante NewArrayExpression representa un tipo de matriz cuyo rango es igual a la longitud de y cuyo tipo de bounds elemento es type.

La Type propiedad de cada elemento de bounds debe representar un tipo entero.

Se aplica a