Expression.ArrayLength Method

Creates a UnaryExpression that represents an expression for obtaining the length of a one-dimensional array.

Namespace:  System.Linq.Expressions
Assembly:  System.Core (in System.Core.dll)

public static UnaryExpression ArrayLength(
	Expression array


Type: System.Linq.Expressions.Expression
An Expression to set the Operand property equal to.

Return Value

Type: System.Linq.Expressions.UnaryExpression
A UnaryExpression that has the NodeType property equal to ArrayLength and the Operand property equal to array.


array is null.


array.Type does not represent an array type.

The Type property of array must represent an array type.

The Type property of the resulting UnaryExpression is equal to Int32. The Method property is null, and both IsLifted and IsLiftedToNull are set to false.


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.