Find and FindAll in generic collections

Weijie Lin


Weijie Lin
In .NET 2.0, searching through generic collections such as Arrays and Lists are easier with the new Find and FindAll methods. Both methods accepts a Predicate parameter, which is a delegate to a method. According to MSDN, these methods run in O(n). In situations like searching for item(s) in a collection, I used to write utility functions with simple bubble sort algorithm. This causes code duplication and O(n^2) is just too slow.
Therefore, I wrote couple of test cases to explore these two new methods. Check it out!
TestFixtureSetUp