c# check list is null or empty 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");
}