Skip to content

Commit 2f688b9

Browse files
committed
Update CollectionExtensions.cs
1 parent 1204ccb commit 2f688b9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/CodeOfChaos.Extensions/CollectionExtensions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Imports
33
// ---------------------------------------------------------------------------------------------------------------------
44
using System.Collections;
5-
using System.Diagnostics.CodeAnalysis;
65

76
// ReSharper disable once CheckNamespace
87
namespace System;
@@ -13,6 +12,9 @@ public static class CollectionExtensions {
1312
public static bool IsEmpty<T>(this IEnumerable<T> source) => source switch {
1413
ICollection<T> collection => collection.Count == 0,
1514
ICollection collection => collection.Count == 0,
15+
IReadOnlyCollection<T> collection => collection.Count == 0,
16+
string str => str.Length == 0,
17+
null => true,
1618
_ => !source.Any()
1719
};
1820

0 commit comments

Comments
 (0)