check if list is empty c# code example
Example 1: c# check if string is empty
if (string.IsNullOrEmpty(myString)) {
}
Example 2: check if list is empty python
if len(li) == 0:
print('the list is empty')
Example 3: c# tell if list object is empty
if(listOfObjects.Count == 0){
}
Example 4: how to check a list is null or empty in c#
if ( (myList!= null) && (!myList.Any()) )
{
myList.Add("new item");
}
Example 5: check if list contains any empty element in c#
if (myList.Any(i => i != null))
{
DoSomeThing();
}