Added IsNotNullAndNotEmpty

This commit is contained in:
Mira 2022-07-31 18:35:07 +02:00
parent bdffd405f8
commit 2ef5f0bc9a
Signed by untrusted user who does not match committer: Xorog
GPG key ID: 983798ED9C3E7C36

View file

@ -22,6 +22,11 @@ public static class UniversalExtensions
int rng = new Random().Next(0, obj.Count()); int rng = new Random().Next(0, obj.Count());
return obj.ElementAt(rng) ?? throw new ArgumentNullException(); return obj.ElementAt(rng) ?? throw new ArgumentNullException();
} }
public static bool IsNotNullAndNotEmpty<T>(this IEnumerable<T> obj)
{
return obj is not null && obj.Any();
}
/// <summary> /// <summary>
/// Get the current CPU Usage on all plattforms /// Get the current CPU Usage on all plattforms