KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the System.Linq namespace, we can now extend our IEnumerable's to have the Any() and Count() extension methods . I was told recently that if I want to check that a collection contains one or more items inside it, I should use the .Any() extension method instead of .Count() > 0 because the .Count() extension method has to iterate through all the items. Secondly, some collections have a property (not an extension method) that is Count or Length . Would it be better to use those instead of .Any() or .Count() ? yea / nae?
Tags (comma-separated)
Save Edits
Cancel