Items - Finding


Exists

System.Collections.Generic.List<int> mylist; 
mylist = new System.Collections.Generic.List<int>();
mylist.Add(10);
mylist.Add(20);
if (mylist.Exists(x => x == 20) == false)
{
}

First

If you try and use First when there are no values, an exception will be thrown


FirstOrDefault

If you try and use FirstOrDefault when there are no values, the default value will be returned instead of an exception



How to quickly find a particular item anything equivalent to a Dictionary - ContainsKey ?


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext