Wednesday, 30 September 2015

how to remove empty line when reading text file using C#



IEnumerable<string> lines = File.ReadLines().Where(line => line != "");

or

List<string> lines = File.ReadLines().Where(line => line != "").ToList();