O'Reilly logo

Microsoft® Visual Basic® 2010 Developer’s Handbook by Klaus Löffelmann and Sarika Calla Purohit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Select Method

The next method is Select. This method can replace an element in a collection with a corresponding element from a second collection with a different type, based on its ordinal number. The following example uses two arrays of different types:

Private numbers As Integer() = New Integer() {9, 1, 4, 2, 5, 8, 6, 7, 3, 0}
Private NumberNames As String() = New String() {"zero", "one", "two", "three",
                                                "four", "five", "six", "seven",
                                                "eight", "nine"}

With those collections, you can create a collection by using the Select statement to retrieve elements in the second array, based on the content of elements in the first array.

Public Sub SelectBeispiel() ' Here Select is used to replace an element based on its ' value with an element in another ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required