This post will discuss how to remove empty strings from a List in C#.

The List<T>.RemoveAll() method removes all the elements from a list that match the conditions defined by the specified predicate. The following code demonstrates the usage of List’s RemoveAll() method to in-place remove empty strings from a list and maintain the order of elements.

Download  Run Code

 
To check whether the specified string is null or empty, use the String.IsNullOrEmpty() convenience method.

Download  Run Code

 
To additionally check for the specified string consists of only white-space characters, use String.IsNullOrWhiteSpace() convenience method.

Download  Run Code

That’s all about removing empty strings from a List in C#.