var document = new TextDocument();
document.Language = CSharpLanguage.Instance;
This topic introduces the TextDocument and explains how to set a language on the TextDocument.
The following topics are prerequisites to understanding this topic:
The TextDocument is a class in the Infragistics.Documents namespace which provides all the functionality for parsing and modifying a document. To set custom languages (or one of the predefined languages) use the Language property of the TextDocument
class.
For example, here is how to set a C# language to the TextDocument
:
In C#:
var document = new TextDocument();
document.Language = CSharpLanguage.Instance;
To load content in the document you can use the InitializeText method or one of the Load methods. As changes are made to the document, almost all tokens are reused so that the lexical analyzer only needs to analyze the parts of the document which have changed.
The following topics provide additional information related to this topic.