Junior Collections

What is the difference between Find() and FindAll() in List<T>?

Method Returns

Find() First match

FindAll

All matches in a new list

Example:

var firstEven = list.Find(x => x % 2 == 0);

var allEvens = list.FindAll(x => x % 2 == 0);

More from C# Programming Tutorial

All questions for this course