Checklist line is null or empty
3 answers
var emptyStrings = MyList.Where(p => string.IsNullOrWhiteSpace(p)).ToList(); var listWithoutEmptyStrings = MyList.Where(p => string.IsNullOrWhiteSpace(p)).ToList(); If you just want to check if the list contains one or more of these elements:
if (MyList.Any(p => string.IsNullOrWhiteSpace(p))) { } If you want to check if all elements are empty or empty
if (MyList.All(p => string.IsNullOrWhiteSpace(p))) { } +1