Equality Operators

You might want to compare two sequences to check whether they are perfectly equal. The SequenceEqual extension method allows performing this kind of comparison. It compares whether a sequence is equal considering both items and the items order within a sequence, returning a Boolean value. The following code returns True because both sequences contain the same items in the same order:

Dim first = {"Visual", "Basic", "2015"}Dim second = {"Visual", "Basic", "2015"}'Returns TrueDim comparison = first.SequenceEqual(second)

The following code returns instead False because, although both sequences contain the same items, they are ordered differently:

Dim first = {"Visual", ...

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.