The StringCollection Collection

The System.Collections.Specialized.StringCollection is similar to the ArrayList collection except that it is limited to accepting only strings. The following code provides an example:

Dim stringDemo As New StringCollectionstringDemo.Add("Alessandro")stringDemo.Add("Del Sole")'Returns TrueDim containsString As Boolean = stringDemo.Contains("Del Sole")stringDemo.Remove("Alessandro")

You can use the same members of ArrayList and perform the same operations.

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.