Expression.NewArrayBounds Expression.NewArrayBounds Expression.NewArrayBounds Method

定義

指定したランクを持つ配列の作成を表す NewArrayExpression を作成します。Creates a NewArrayExpression that represents creating an array that has a specified rank.

オーバーロード

NewArrayBounds(Type, Expression[]) NewArrayBounds(Type, Expression[]) NewArrayBounds(Type, Expression[])

指定したランクを持つ配列の作成を表す NewArrayExpression を作成します。Creates a NewArrayExpression that represents creating an array that has a specified rank.

NewArrayBounds(Type, IEnumerable<Expression>) NewArrayBounds(Type, IEnumerable<Expression>) NewArrayBounds(Type, IEnumerable<Expression>)

指定したランクを持つ配列の作成を表す NewArrayExpression を作成します。Creates a NewArrayExpression that represents creating an array that has a specified rank.

NewArrayBounds(Type, Expression[]) NewArrayBounds(Type, Expression[]) NewArrayBounds(Type, Expression[])

指定したランクを持つ配列の作成を表す NewArrayExpression を作成します。Creates a NewArrayExpression that represents creating an array that has a specified rank.

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

パラメーター

type
Type Type Type

配列の要素の型を表す TypeA Type that represents the element type of the array.

bounds
Expression[]

Expression コレクションへの読み込みに使用する Expressions オブジェクトの配列。An array of Expression objects to use to populate the Expressions collection.

戻り値

NewArrayExpression と等しい NodeType プロパティおよび指定した値に設定された NewArrayBounds プロパティを含む ExpressionsA NewArrayExpression that has the NodeType property equal to NewArrayBounds and the Expressions property set to the specified value.

例外

type または boundsnull です。type or bounds is null.

または-or- bounds の要素は null です。An element of bounds is null.

bounds の要素の Type プロパティは、整数型を表しません。The Type property of an element of bounds does not represent an integral type.

次の例では、使用する方法、NewArrayBounds文字列配列の作成を表す式ツリーを作成するメソッドが 2 のランク。The following example demonstrates how to use the NewArrayBounds method to create an expression tree that represents creating a string array that has a rank of 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)

注釈

TypeプロパティNewArrayExpressionランクがの長さと等しい、配列型を表すbounds要素型があるとtypeします。The Type property of the resulting NewArrayExpression represents an array type whose rank is equal to the length of bounds and whose element type is type.

Typeの各要素のプロパティbounds整数型を表す必要があります。The Type property of each element of bounds must represent an integral type.

NewArrayBounds(Type, IEnumerable<Expression>) NewArrayBounds(Type, IEnumerable<Expression>) NewArrayBounds(Type, IEnumerable<Expression>)

指定したランクを持つ配列の作成を表す NewArrayExpression を作成します。Creates a NewArrayExpression that represents creating an array that has a specified rank.

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

パラメーター

type
Type Type Type

配列の要素の型を表す TypeA Type that represents the element type of the array.

bounds
IEnumerable<Expression>

IEnumerable<T> コレクションへの読み込みに使用する Expression オブジェクトを含む ExpressionsAn IEnumerable<T> that contains Expression objects to use to populate the Expressions collection.

戻り値

NewArrayExpression と等しい NodeType プロパティおよび指定した値に設定された NewArrayBounds プロパティを含む ExpressionsA NewArrayExpression that has the NodeType property equal to NewArrayBounds and the Expressions property set to the specified value.

例外

type または boundsnull です。type or bounds is null.

または-or- bounds の要素は null です。An element of bounds is null.

bounds の要素の Type プロパティは、整数型を表しません。The Type property of an element of bounds does not represent an integral type.

次の例では、使用する方法、NewArrayBounds文字列配列の作成を表す式ツリーを作成するメソッドが 2 のランク。The following example demonstrates how to use the NewArrayBounds method to create an expression tree that represents creating a string array that has a rank of 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)

注釈

TypeプロパティNewArrayExpressionランクがの長さと等しい、配列型を表すbounds要素型があるとtypeします。The Type property of the resulting NewArrayExpression represents an array type whose rank is equal to the length of bounds and whose element type is type.

Typeの各要素のプロパティbounds整数型を表す必要があります。The Type property of each element of bounds must represent an integral type.

適用対象