AvalonStudio.TextEditor.Document.TextDocument.VerifyAccess C# (CSharp) Method

VerifyAccess() public method

Verifies that the current thread is the documents owner thread. Throws an InvalidOperationException if the wrong thread accesses the TextDocument.

The TextDocument class is not thread-safe. A document instance expects to have a single owner thread and will throw an InvalidOperationException when accessed from another thread. It is possible to change the owner thread using the SetOwnerThread method.

public VerifyAccess ( ) : void
return void
		public void VerifyAccess()
		{
			if (Thread.CurrentThread != owner)
				throw new InvalidOperationException("TextDocument can be accessed only from the thread that owns it.");
		}

Usage Example

Example #1
0
 DocumentLine IList <DocumentLine> .this[int index]
 {
     get
     {
         document.VerifyAccess();
         return(GetByNumber(1 + index));
     }
     set
     {
         throw new NotSupportedException();
     }
 }
All Usage Examples Of AvalonStudio.TextEditor.Document.TextDocument::VerifyAccess