Share via


ITextBufferFactoryService2.CreateTextBuffer Method

Definition

Overloads

CreateTextBuffer(SnapshotSpan, IContentType)

Creates an ITextBuffer with the specified IContentType and populates it with the given text contained in span.

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

Creates an ITextBuffer with the given contentType and populates it by reading data from the specified TextReader.

CreateTextBuffer(SnapshotSpan, IContentType)

Creates an ITextBuffer with the specified IContentType and populates it with the given text contained in 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

Parameters

span
SnapshotSpan

The initial text to add.

contentType
IContentType

The IContentType for the new ITextBuffer.

Returns

A ITextBuffer object with the given text and IContentType.

Exceptions

Either span or contentType is null.

Remarks

This method can be called on any thread. This method will raise TextBufferCreated and ContentTypeChanged(ITextBuffer, IContentType, IContentType) on the thread that it was called.

Applies to

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

Creates an ITextBuffer with the given contentType and populates it by reading data from the specified 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

Parameters

reader
TextReader

The TextReader from which to read.

contentType
IContentType

The contentType for the text contained in the new ITextBuffer

length
Int64

The length of the file backing the text reader, if known; otherwise -1.

traceId
String

An optional identifier used in debug tracing.

throwOnInvalidCharacters
Boolean

Throw a FileFormat exception if illegal characters are encountered.

Returns

An ITextBuffer object with the given TextReader and contentType.

Exceptions

contentType is null.

Remarks

This method can be called on any thread. This method will raise TextBufferCreated and ContentTypeChanged(ITextBuffer, IContentType, IContentType) on the thread that it was called.

Applies to