Passes an ArraySegment<(Of <(T>)>) structure to a method. : ArraySegment « Data Structure « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Data Structure » ArraySegmentScreenshots 
Passes an ArraySegment<(Of <(T>)>) structure to a method.
  

Imports System

Public Class SamplesArray
    Public Shared Sub Main()
         Dim myArr As String() =  {"The""quick""brown""fox""jumps""over""the""lazy""dog"}

         PrintIndexAndValues(myArr)

         Dim myArrSegAll As New ArraySegment(Of String)(myArr)
         PrintIndexAndValues(myArrSegAll)


        Dim myArrSegMid As New ArraySegment(Of String)(myArr, 25)

        PrintIndexAndValues(myArrSegMid)

        myArrSegAll.Array(3"LION"

        PrintIndexAndValues(myArrSegMid)

    End Sub 'Main

    Public Shared Sub PrintIndexAndValues(arrSeg As ArraySegment(Of String))
        Dim As Integer
        For i = arrSeg.Offset To (arrSeg.Offset + arrSeg.Count - 1)
            Console.WriteLine("   [{0}] : {1}", i, arrSeg.Array(i))
        Next i
    End Sub

    Public Shared Sub PrintIndexAndValues(myArr as String())
        Dim As Integer
        For i = To (myArr.Length - 1)
            Console.WriteLine("   [{0}] : {1}", i, myArr(i))
        Next i
    End Sub
End Class

   
    
  
Related examples in the same category
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.