共用方式為


Expression.ArrayLength Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Public Shared Function ArrayLength ( _
    array As Expression _
) As UnaryExpression
public static UnaryExpression ArrayLength(
    Expression array
)

Parameters

Return Value

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

Exceptions

Exception Condition
ArgumentNullException

array is nulla null reference (Nothing in Visual Basic).

ArgumentException

array.Type does not represent an array type.

Remarks

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 nulla null reference (Nothing in Visual Basic), and both IsLifted and IsLiftedToNull are set to false.

Version Information

Silverlight

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

Platforms

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