ITextBufferFactoryService2.CreateTextBuffer 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
CreateTextBuffer(SnapshotSpan, IContentType) |
使用 ITextBuffer 指定的 IContentType 建立 ,並以 中包含的 |
CreateTextBuffer(TextReader, IContentType, Int64, String, Boolean) |
ITextBuffer使用指定的 |
CreateTextBuffer(SnapshotSpan, IContentType)
使用 ITextBuffer 指定的 IContentType 建立 ,並以 中包含的 span
指定文字填入它。
public:
Microsoft::VisualStudio::Text::ITextBuffer ^ CreateTextBuffer(Microsoft::VisualStudio::Text::SnapshotSpan span, Microsoft::VisualStudio::Utilities::IContentType ^ contentType);
public Microsoft.VisualStudio.Text.ITextBuffer CreateTextBuffer (Microsoft.VisualStudio.Text.SnapshotSpan span, Microsoft.VisualStudio.Utilities.IContentType contentType);
abstract member CreateTextBuffer : Microsoft.VisualStudio.Text.SnapshotSpan * Microsoft.VisualStudio.Utilities.IContentType -> Microsoft.VisualStudio.Text.ITextBuffer
Public Function CreateTextBuffer (span As SnapshotSpan, contentType As IContentType) As ITextBuffer
參數
- span
- SnapshotSpan
要加入的初始文字。
- contentType
- IContentType
新 IContentType 的 ITextBuffer。
傳回
ITextBuffer具有指定文字和IContentType的物件。
例外狀況
span
或 contentType
為 null。
備註
這個方法可以在任何線程上呼叫。 這個方法會在呼叫它的線程上引發 TextBufferCreated 和 ContentTypeChanged(ITextBuffer, IContentType, IContentType) 。
適用於
CreateTextBuffer(TextReader, IContentType, Int64, String, Boolean)
ITextBuffer使用指定的 contentType
建立 ,並從指定的 TextReader 讀取數據來填入它。
public Microsoft.VisualStudio.Text.ITextBuffer CreateTextBuffer (System.IO.TextReader reader, Microsoft.VisualStudio.Utilities.IContentType contentType, long length = -1, string traceId = "", bool throwOnInvalidCharacters = false);
abstract member CreateTextBuffer : System.IO.TextReader * Microsoft.VisualStudio.Utilities.IContentType * int64 * string * bool -> Microsoft.VisualStudio.Text.ITextBuffer
Public Function CreateTextBuffer (reader As TextReader, contentType As IContentType, Optional length As Long = -1, Optional traceId As String = "", Optional throwOnInvalidCharacters As Boolean = false) As ITextBuffer
參數
- reader
- TextReader
要從中讀取的 TextReader。
- contentType
- IContentType
新中包含的文字的 。contentType
ITextBuffer
- length
- Int64
如果已知,則為備份文字讀取器之檔案的長度;否則為 -1。
- traceId
- String
偵錯追蹤中使用的選擇性標識碼。
- throwOnInvalidCharacters
- Boolean
如果遇到不合法的字元,則會擲回 FileFormat 例外狀況。
傳回
ITextBuffer具有指定 TextReader 和 contentType
的物件。
例外狀況
contentType
為 null。
備註
這個方法可以在任何線程上呼叫。 這個方法會在呼叫它的線程上引發 TextBufferCreated 和 ContentTypeChanged(ITextBuffer, IContentType, IContentType) 。