Mega Code Archive

 
Categories / VB.Net / Data Structure
 

Enumerable SequenceEqual Determines whether two sequences are equal by comparing the elements

Imports System Imports System.Linq Imports System.Collections.Generic     Class Pet         Public Name As String         Public Age As Integer     End Class Public Class Example     Public Shared Sub Main()          Dim pet1 As New Pet With {.Name = "A", .Age = 2}         Dim pet2 As New Pet With {.Name = "B", .Age = 8}         Dim pets1 As New List(Of Pet)(New Pet() {pet1, pet2})         Dim pets2 As New List(Of Pet)(New Pet() {pet1, pet2})         Dim equal As Boolean = pets1.SequenceEqual(pets2)         Console.WriteLine(equal)     End Sub End Class