Imports System
Imports System.Collections.Generic
Public Class Example
Public Shared Sub Main()
Dim input() As String = { "F","B","C" }
Dim letters As New List(Of String)(input)
Console.WriteLine( "Capacity: {0}", letters.Capacity)
For Each letter As String In letters
Console.WriteLine(letter)
Next
Console.WriteLine("AddRange(letters)")
letters.AddRange(letters)
For Each letter As String In letters
Console.WriteLine(letter)
Next
Console.WriteLine("RemoveRange(2, 2)")
letters.RemoveRange(2, 2)
For Each letter As String In letters
Console.WriteLine(letter)
Next
input = New String() { "A","D","Z" }
Console.WriteLine("InsertRange(3, input)")
letters.InsertRange(3, input)
Console.WriteLine()
For Each letter As String In letters
Console.WriteLine(letter)
Next
Console.WriteLine("output = letters.GetRange(2, 3).ToArray")
Dim output() As String = letters.GetRange(2, 3).ToArray()
For Each letter As String In output
Console.WriteLine(letter)
Next
End Sub
End Class
|