Thursday, June 18, 2009

List.Contains(T obj)

I don't think it is worth using this on most occasions.

First, this is BigO(n), which is the same as linearly searching the list.

Secondly, if you have a complex object, you must implement IEqualityComparer interface, which only has a GetHashCode method, which returns an int.

I don't think this is too useful.

No comments:

Post a Comment