Partager via


Expression.NewArrayBounds Méthode

Définition

Crée un NewArrayExpression tableau qui représente la création d’un tableau dont le rang est spécifié.

Surcharges

Nom Description
NewArrayBounds(Type, Expression[])

Crée un NewArrayExpression tableau qui représente la création d’un tableau dont le rang est spécifié.

NewArrayBounds(Type, IEnumerable<Expression>)

Crée un NewArrayExpression tableau qui représente la création d’un tableau dont le rang est spécifié.

NewArrayBounds(Type, Expression[])

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

Crée un NewArrayExpression tableau qui représente la création d’un tableau dont le rang est spécifié.

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);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Creating arrays at runtime requires dynamic code generation.")]
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
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Creating arrays at runtime requires dynamic code generation.")>]
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

Paramètres

type
Type

Qui Type représente le type d’élément du tableau.

bounds
Expression[]

Tableau d’objets Expression à utiliser pour remplir la Expressions collection.

Retours

Qui NewArrayExpression a la NodeType propriété égale à NewArrayBounds et la Expressions propriété définie sur la valeur spécifiée.

Attributs

Exceptions

type ou bounds est null.

- ou -

Un élément de bounds .null

La Type propriété d’un élément de bounds n’est pas un type intégral.

Exemples

L’exemple suivant montre comment utiliser la méthode pour créer une arborescence d’expressions qui représente la création d’un tableau de chaînes dont le NewArrayBounds rang est 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)

Remarques

La Type propriété du résultat NewArrayExpression représente un type de tableau dont le classement est égal à la longueur et dont le type d’élément bounds est type.

La Type propriété de chaque élément de bounds doit représenter un type intégral.

S’applique à

NewArrayBounds(Type, IEnumerable<Expression>)

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

Crée un NewArrayExpression tableau qui représente la création d’un tableau dont le rang est spécifié.

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);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Creating arrays at runtime requires dynamic code generation.")]
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
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Creating arrays at runtime requires dynamic code generation.")>]
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

Paramètres

type
Type

Qui Type représente le type d’élément du tableau.

bounds
IEnumerable<Expression>

Qui IEnumerable<T> contient des Expression objets à utiliser pour remplir la Expressions collection.

Retours

Qui NewArrayExpression a la NodeType propriété égale à NewArrayBounds et la Expressions propriété définie sur la valeur spécifiée.

Attributs

Exceptions

type ou bounds est null.

- ou -

Un élément de bounds .null

La Type propriété d’un élément de bounds n’est pas un type intégral.

Exemples

L’exemple suivant montre comment utiliser la méthode pour créer une arborescence d’expressions qui représente la création d’un tableau de chaînes dont le NewArrayBounds rang est 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)

Remarques

La Type propriété du résultat NewArrayExpression représente un type de tableau dont le classement est égal à la longueur et dont le type d’élément bounds est type.

La Type propriété de chaque élément de bounds doit représenter un type intégral.

S’applique à