Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/libraries/System.Linq/src/System/Linq/AnyAll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public static bool Any<TSource>(this IEnumerable<TSource> source)
{
return collectionoft.Count != 0;
}

if (source is IReadOnlyCollection<TSource> readOnlyCollection)
return readOnlyCollection.Count != 0;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use curly braces


else if (source is IIListProvider<TSource> listProv)
{
// Note that this check differs from the corresponding check in
Expand All @@ -38,6 +42,7 @@ public static bool Any<TSource>(this IEnumerable<TSource> source)
{
return collection.Count != 0;
}


using (IEnumerator<TSource> e = source.GetEnumerator())
{
Expand Down