I use ADO.NET entity framework and very often there are code snippets like this :
List<Sole> entity = soleService.All()
.Where(s => (s.ShoeLastID == shoeLastID) && (s.Status == 20))
.ToList();
Since now I haven't think much about it and just made this check:
if (entity.Count > 0)
believing that it is enough. Now I see that many people check with Any()
and for null
. How to be sure at a certain situation what kind of checks I need and in this certain scenario which as I said - I use very often is if (entity.Count > 0)
enough?