DocumentLine IList <DocumentLine> .this[int index] {
     get {
         document.VerifyAccess();
         return(GetByNumber(1 + index));
     }
     set {
         throw new NotSupportedException();
     }
 }
        /// <summary>
        /// Creates a new TextSegmentCollection that updates the offsets automatically.
        /// </summary>
        /// <param name="textDocument">The document to which the text segments
        /// that will be added to the tree belong. When the document changes, the
        /// position of the text segments will be updated accordingly.</param>
        public TextSegmentCollection(TextDocument textDocument)
        {
            if (textDocument == null)
            {
                throw new ArgumentNullException("textDocument");
            }

            textDocument.VerifyAccess();
            isConnectedToDocument = true;
            TextDocumentWeakEventManager.Changed.AddListener(textDocument, this);
        }