Mid
From PDF
Collections
C# Collections
What methods does the List<T> class provide to search for an element?
- Contains(item)
- IndexOf(item)
- Find(predicate)
- FindAll(predicate)
- Exists(predicate)
- BinarySearch(item) (for sorted lists)
Example:
bool hasItem = numbers.Contains(10);
int index = numbers.IndexOf(10);
var result = numbers.Find(x => x > 50);Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png