csharp tell if list object is empty

Code Example - csharp tell if list object is empty

                
                        if(listOfObjects.Count == 0){
//when list is empty
}
                    
                
 

csharp check if array is empty

                        
                                if(array == null || array.Length == 0)
                            
                        
 

how to check a list is null or empty in csharp

                        
                                if ( (myList!= null) && (!myList.Any()) )
 {
     // Add new item
     myList.Add("new item"); 
 }
                            
                        
 

csharp check if list is empty

                        
                                if (!myList.EmptyIfNull().Any())
{
	DoSomething();
}
                            
                        
 

check if list contains any empty element in csharp

                        
                                if (myList.Any(i => i != null))
{
    DoSomeThing();
}