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"}
myCol.AddRange(myArr)
If myCol.Contains("orange") Then
Console.WriteLine("The collection contains ""orange"" at index {0}.", myCol.IndexOf("orange"))
Else
Console.WriteLine("The collection does not contain ""orange"".")
End If
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
Console.WriteLine()
End Sub
End Class