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