Trying to find the longest and shortest line in a text file. The longest one returns correctly, but the shortest one is always empty, any ideas?
var lines = System.IO.File.ReadLines(@"C:\test.txt"); var Minimum = ""; var Maximum = ""; foreach (string line in lines) { if (Maximum.Length < line.Length) { Maximum = line; } if (Minimum.Length > line.Length) { Minimum = line; } }
source share