.net 5 check list empty and null code example
Example: how to check a list is null or empty in c#
if ( (myList!= null) && (!myList.Any()) )
{
// Add new item
myList.Add("new item");
}
if ( (myList!= null) && (!myList.Any()) )
{
// Add new item
myList.Add("new item");
}