Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikus1993 committed Jan 29, 2024
1 parent f4fce39 commit 25470e4
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using System.Runtime.CompilerServices;

namespace XboxPromotionCheckerBot.App.Core.Extensions;

public static class EnumerableExtensions
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool IsEmpty<T>(this IEnumerable<T> enumerable)
{
ArgumentNullException.ThrowIfNull(enumerable);
if (enumerable.TryGetNonEnumeratedCount(out var count))
{
return count == 0;
}

return !enumerable.Any();
}
}

0 comments on commit 25470e4

Please sign in to comment.