We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1204ccb commit 2f688b9Copy full SHA for 2f688b9
src/CodeOfChaos.Extensions/CollectionExtensions.cs
@@ -2,7 +2,6 @@
2
// Imports
3
// ---------------------------------------------------------------------------------------------------------------------
4
using System.Collections;
5
-using System.Diagnostics.CodeAnalysis;
6
7
// ReSharper disable once CheckNamespace
8
namespace System;
@@ -13,6 +12,9 @@ public static class CollectionExtensions {
13
12
public static bool IsEmpty<T>(this IEnumerable<T> source) => source switch {
14
ICollection<T> collection => collection.Count == 0,
15
ICollection collection => collection.Count == 0,
+ IReadOnlyCollection<T> collection => collection.Count == 0,
16
+ string str => str.Length == 0,
17
+ null => true,
18
_ => !source.Any()
19
};
20
0 commit comments