.any()
This will return a true if the collection has any records.
For example
1 | If (programRequirementsResult.Model.Where(e => e.IsDeleted == false).ToList().Count>0) |
Vs
1 | programRequirementsResult.Model.Where(e => e.IsDeleted == false).ToList().Any() |
It’s considered better programming practice to use the Any() method, because it’s clearer. The first check means ‘do we have more than 0 records’. The second statement means ‘do we have any records’ This is usually the intent.