public override string ToString()
{
// Make sure all lines have endings, with the exception of the last line.
var contents = new StringBuilder();
for (int i = 0; i < Lines.Count; i++)
{
var line = Lines[i];
if (i < Lines.Count - 1 && !HasEnding(line))
{
contents.AppendLine(line);
}
else
{
contents.Append(line);
}
}
return contents.ToString();
}