private int IndexOfEndOfLine(int startIndex) { int index = this.text.IndexOf('\n', startIndex); return ((index == -1) ? this.text.Length : index); }