Mega Code Archive
Collection Remove
Option Strict On
Public Module CollectionTest
Public Sub Main()
Dim weights As New Collection
weights.Add("ounces", "oz")
weights.Add("pounds", "lbs")
weights.Add("kilograms", "kg")
weights.Add("milligrams", "mg")
For ordinal As Integer = weights.Count To 1 Step -1
weights.Remove(ordinal)
Next
Console.WriteLine("The collection now has {0} items.", weights.Count)
End Sub
End Module