public static void AddHistory(string line) { if (line == null) line = String.Empty; if (maxHistorySize != 0 && history.Count == maxHistorySize) // Remove the oldest entry, to preserve the maximum size. history.RemoveAt(0); history.Add(line); }