check if list contains any empty element in csharp
Code Example - check if list contains any empty element in csharp
if (myList.Any(i => i != null))
{
DoSomeThing();
}
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 tell if list object is empty
if(listOfObjects.Count == 0){
//when list is empty
}
csharp check if list is empty
if (!myList.EmptyIfNull().Any())
{
DoSomething();
}