A lot depends on how you define "equal" and what the actual format of the two classes are.
Assuming that
Test
and
Test1
are different names for the same object, you would first compare the lengths of
List1
and
List2
; if they are not the same, they are not equal. Then you would iterate through every object in
List1
and compare every element with the corresponding element in the corresponding object in
List2
.
Public Function AreTheyEqual( _
ByVal L1 As List(Of Test), _
ByVal L2 As List(Of Test1) _
) As Boolean
If L1.Count <> L2.Count Then Return False
For i As Integer = 0 To L1.Count - 1
Dim T1 As Test = L1(i)
Dim T2 As Test1 = L2(i)
If T1.Property1 <> T2.Property1 Then Return False
If T1.Property2 <> T2.Property2 Then Return False
....
Next
Return True
End Function
Things get a bit more challenging if the two classes are different: again, you would need to define what "equals" actually means.