From 2ef5f0bc9ad347ec949b6eacadecbc862f1036e6 Mon Sep 17 00:00:00 2001 From: Mira <56395159+TheXorog@users.noreply.github.com> Date: Sun, 31 Jul 2022 18:35:07 +0200 Subject: [PATCH] Added IsNotNullAndNotEmpty --- UniversalExtensions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UniversalExtensions.cs b/UniversalExtensions.cs index f71caef..deff631 100644 --- a/UniversalExtensions.cs +++ b/UniversalExtensions.cs @@ -22,6 +22,11 @@ public static class UniversalExtensions int rng = new Random().Next(0, obj.Count()); return obj.ElementAt(rng) ?? throw new ArgumentNullException(); } + + public static bool IsNotNullAndNotEmpty(this IEnumerable obj) + { + return obj is not null && obj.Any(); + } /// /// Get the current CPU Usage on all plattforms