Partager via


ArraySegment<T> Constructor (array<T[])

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

Initializes a new instance of the ArraySegment<T> structure that delimits all the elements in the specified array.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public Sub New ( _
    array As T() _
)
public ArraySegment(
    T[] array
)

Parameters

  • array
    Type: array<T[]
    The array to wrap.

Exceptions

Exception Condition
ArgumentNullException

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

Remarks

This constructor creates an ArraySegment<T> that delimits all the elements of array. That is, the Offset property of the ArraySegment<T> is 0 and its Count property is the length of array. To create an ArraySegment<T> that delimits only part of an array, use the ArraySegment<T>(array<T[], Int32, Int32) constructor.

The original array must be one-dimensional and must have zero-based indexing.

Multiple ArraySegment<T> instances can refer to the same original array and can overlap.

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: Xbox 360, 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.