Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a NewArrayExpression that represents creating an array that has a specified rank.
NewArrayBounds(Type, Expression[]) |
Creates a NewArrayExpression that represents creating an array that has a specified rank. |
NewArrayBounds(Type, IEnumerable<Expression>) |
Creates a NewArrayExpression that represents creating an array that has a specified rank. |
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
Public Shared Function NewArrayBounds (type As Type, ParamArray bounds As Expression()) As NewArrayExpression
An array of Expression objects to use to populate the Expressions collection.
A NewArrayExpression that has the NodeType property equal to NewArrayBounds and the Expressions property set to the specified value.
The Type property of an element of bounds
does not represent an integral type.
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)
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
.
The Type property of each element of bounds
must represent an integral type.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
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
Public Shared Function NewArrayBounds (type As Type, bounds As IEnumerable(Of Expression)) As NewArrayExpression
An IEnumerable<T> that contains Expression objects to use to populate the Expressions collection.
A NewArrayExpression that has the NodeType property equal to NewArrayBounds and the Expressions property set to the specified value.
The Type property of an element of bounds
does not represent an integral type.
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)
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
.
The Type property of each element of bounds
must represent an integral type.
Product | Versions |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10 |
.NET Framework | 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 1.0, 1.1, 1.2, 1.3, 1.4, 1.6, 2.0, 2.1 |
UWP | 10.0 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in