generic list with contains item

  • Thread starter Thread starter Smokey Grindel
  • Start date Start date
S

Smokey Grindel

I have a list of items that is in the list of <T> format... and then in that
are objects I created that implement the IComparable interface... now if I
took this list and did a contains(objectThatIsAlreadyInList) would it find
it? how exactly does contains in a generic list work? is it just by object
reference or does it use the Comparable interface to check if it has an
item? thanks!
 
how exactly does contains in a generic list work? is it just by object
reference or does it use the Comparable interface to check if it has an
item?

Have another look at the documentation for List(Of T).Contains, it
actually says exactly how existance is determined. Basically it uses
IEquatable if implemented, otherwise Object.Equals.


Mattias
 
Back
Top