SetOwnerThread Method (newOwner)
Transfers ownership of the document to another thread. This method can be used to load a file into a TextDocument on a background thread and then transfer ownership to the UI thread for displaying the document.
Declaration Syntax
C#Visual BasicVisual C++
public void SetOwnerThread(
	Thread newOwner
Public Sub SetOwnerThread ( _
	newOwner As Thread _
void SetOwnerThread(
	Thread^ newOwner
newOwner (Thread)

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(Thread) method.

The owner can be set to null, which means that no thread can access the document. But, if the document has no owner thread, any thread may take ownership by calling SetOwnerThread(Thread).

Assembly: ICSharpCode.AvalonEdit (Module: ICSharpCode.AvalonEdit.dll) Version: