StringCollection.Clear Method removes all the strings from the StringCollection.
Imports System
Imports System.Collections
Imports System.Collections.Specialized
Public Class SamplesStringCollection
Public Shared Sub Main()
Dim myCol As New StringCollection()
Dim myArr() As [String] = {"RED", "orange", "yellow", "RED", "green", "blue", "RED", "indigo", "violet", "RED"}
myCol.AddRange(myArr)
myCol.Clear()
PrintValues(myCol)
End Sub 'Main
Public Shared Sub PrintValues(myCol As IEnumerable)
Dim obj As [Object]
For Each obj In myCol
Console.WriteLine(" {0}", obj)
Next obj
End Sub
End Class
Related examples in the same category