I have a custom class set up as a key that has two properties, X and Y
I have something similar to this:
Dim test As New List(of TestClass)
Dim key as New TestData
key._a = A
key._b = B
For Each a As TestClass In SomeCollection
If Not test.Contains(key) Then
'Do Stuff
End If
Next
My question is this: How does the .Contains on the List(of T) behave? Does it look for an identical data structure, or does it simply match on one of the properties of my key?
If you can, please include a link where I can look at some documentation regarding this.
EDIT Is the Contains method Typesafe?
It uses the Equals
method to check for identity.
By default (if not overridden) Equals
returns true
if two references are identical or two structures are equal memberwise.