ArraySegment<T> Structure
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Delimits a section of a one-dimensional array.
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Structure ArraySegment(Of T)
public struct ArraySegment<T>
Type Parameters
- T
The type of the elements in the array segment.
The ArraySegment<T> type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ArraySegment<T>(array<T[]) | Initializes a new instance of the ArraySegment<T> structure that delimits all the elements in the specified array. | |
ArraySegment<T>(array<T[], Int32, Int32) | Initializes a new instance of the ArraySegment<T> structure that delimits the specified range of the elements in the specified array. |
Top
Properties
Name | Description | |
---|---|---|
Array | Gets the original array containing the range of elements that the array segment delimits. | |
Count | Gets the number of elements in the range delimited by the array segment. | |
Offset | Gets the position of the first element in the range delimited by the array segment, relative to the start of the original array. |
Top
Methods
Name | Description | |
---|---|---|
Equals(ArraySegment<T>) | Determines whether the specified ArraySegment<T> structure is equal to the current instance. | |
Equals(Object) | Determines whether the specified object is equal to the current instance. (Overrides ValueType.Equals(Object).) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Returns the hash code for the current instance. (Overrides ValueType.GetHashCode().) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns the fully qualified type name of this instance. (Inherited from ValueType.) |
Top
Operators
Name | Description | |
---|---|---|
Equality | Indicates whether two ArraySegment<T> structures are equal. | |
Inequality | Indicates whether two ArraySegment<T> structures are unequal. |
Top
Remarks
ArraySegment<T> is a wrapper around an array that delimits a range of elements in that array. Multiple ArraySegment<T> instances can refer to the same original array and can overlap.
The Array property returns the entire original array, not a copy of the array; therefore, changes made to the array returned by the Array property are made to the original array.
The original array must be one-dimensional and must have zero-based indexing.
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.
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.