ITextBufferFactoryService2.CreateTextBuffer 方法

定义

重载

CreateTextBuffer(SnapshotSpan, IContentType)

使用指定的 IContentType 创建 ,ITextBuffer并使用 中包含的span给定文本填充它。

CreateTextBuffer(TextReader, IContentType, Int64, String, Boolean)

使用给定 contentType 的 创建 ,ITextBuffer并通过从指定的 TextReader 读取数据来填充它。

CreateTextBuffer(SnapshotSpan, IContentType)

使用指定的 IContentType 创建 ,ITextBuffer并使用 中包含的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

ITextBufferIContentType

返回

具有 ITextBuffer 给定文本 和 IContentType的 对象。

例外

spancontentType 为 null。

注解

可以在任何线程上调用此方法。 此方法将在调用它的线程上引发 TextBufferCreatedContentTypeChanged(ITextBuffer, IContentType, IContentType)

适用于

CreateTextBuffer(TextReader, IContentType, Int64, String, Boolean)

使用给定 contentType 的 创建 ,ITextBuffer并通过从指定的 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。

注解

可以在任何线程上调用此方法。 此方法将在调用它的线程上引发 TextBufferCreatedContentTypeChanged(ITextBuffer, IContentType, IContentType)

适用于