diff --git a/src/Aardvark.Base/Extensions/IEnumerableExtensions.cs b/src/Aardvark.Base/Extensions/IEnumerableExtensions.cs index a33ffec5..1b4489d5 100644 --- a/src/Aardvark.Base/Extensions/IEnumerableExtensions.cs +++ b/src/Aardvark.Base/Extensions/IEnumerableExtensions.cs @@ -879,20 +879,20 @@ public static bool AllEqual(this IEnumerable elements) /// Returns true if elements contains no items or if elements is null, /// false otherwise. /// - public static bool IsEmptyOrNull(this T[] elements) + public static bool IsEmptyOrNull(this Array self) { - if (elements == null) return true; - return elements.Length == 0; + if (self == null) return true; + return self.Length == 0; } /// /// Returns true if elements contains no items or if elements is null, /// false otherwise. /// - public static bool IsEmptyOrNull(this ICollection elements) + public static bool IsEmptyOrNull(this ICollection self) { - if (elements == null) return true; - return elements.Count == 0; + if (self == null) return true; + return self.Count == 0; } /// @@ -2282,11 +2282,28 @@ public static IEnumerable Return(this T item) yield return item; } + /// + /// Determines whether an array contains no elements. + /// + public static bool IsEmpty(this Array self) + { + return self.Length == 0; + } + + /// + /// Determines whether a sequence contains no elements. + /// + public static bool IsEmpty(this ICollection self) + { + return self.Count == 0; + } + /// /// Determines whether a sequence contains no elements. /// public static bool IsEmpty(this IEnumerable self) { + if (self is ICollection col) return col.Count == 0; return !self.Any(); }