Export (0) Print
Expand All

ArraySegment(Of T).IList(Of T).Item Property

.NET Framework 4.5

Gets or sets the element at the specified index.

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

Private Property Item ( _
	index As Integer _
) As T Implements IList(Of T).Item


Type: System.Int32

The zero-based index of the element to get or set.

Property Value

Type: T
The element at the specified index.


IList(Of T).Item


index is not a valid index in the ArraySegment(Of T).


The property is set and the array segment is read-only.

This member is an explicit interface member implementation. It can be used only when the ArraySegment(Of T) instance is cast to an IList(Of T) interface, as the following example shows.

Imports System.Collections.Generic

Module Example
   Public Sub Main()
      Dim names() As String = { "Adam", "Bruce", "Charles", "Daniel", 
                                "Ebenezer", "Francis", "Gilbert", 
                                "Henry", "Irving", "John", "Karl",
                                "Lucian", "Michael" }
      Dim partNames As New ArraySegment(Of String)(names, 2, 5)

      ' Cast the ArraySegment object to an IList<String> and enumerate it. 
      Dim list = CType(partNames, IList(Of String))
      For ctr As Integer = 0 To list.Count - 1
   End Sub 
End Module 
' The example displays the following output: 
'    Charles 
'    Daniel 
'    Ebenezer 
'    Francis 
'    Gilbert

.NET Framework

Supported in: 4.6, 4.5

.NET for Windows Store apps

Supported in: Windows 8

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft