Imports System
Imports System.Collections.Generic
Public Class Example
Public Shared Sub Main()
Dim myList As New List(Of String)
Console.WriteLine("Capacity: {0}", myList.Capacity)
myList.Add("A")
myList.Add("B")
myList.Add("C")
myList.Add("D")
myList.Add("E")
For Each letter As String In myList
Console.WriteLine(letter)
Next
myList.Remove("E")
myList.TrimExcess()
Console.WriteLine(vbLf & "TrimExcess()")
Console.WriteLine("Capacity: {0}", myList.Capacity)
Console.WriteLine("Count: {0}", myList.Count)
End Sub
End Class
|