You can use Enumerable.Any
:
bool isEmpty = !list.Any();
if(isEmpty)
{
// ...
}
If the list could be null
you could use:
bool isNullOrEmpty = list?.Any() != true;
You can use Enumerable.Any
:
bool isEmpty = !list.Any();
if(isEmpty)
{
// ...
}
If the list could be null
you could use:
bool isNullOrEmpty = list?.Any() != true;