Share via


ITextBufferFactoryService3.CreateTextBuffer Method

Definition

Overloads

CreateTextBuffer(ITextImage, IContentType)

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

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)

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

CreateTextBuffer(ITextImage, IContentType)

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

public:
 Microsoft::VisualStudio::Text::ITextBuffer ^ CreateTextBuffer(Microsoft::VisualStudio::Text::ITextImage ^ image, Microsoft::VisualStudio::Utilities::IContentType ^ contentType);
public Microsoft.VisualStudio.Text.ITextBuffer CreateTextBuffer (Microsoft.VisualStudio.Text.ITextImage image, Microsoft.VisualStudio.Utilities.IContentType contentType);
abstract member CreateTextBuffer : Microsoft.VisualStudio.Text.ITextImage * Microsoft.VisualStudio.Utilities.IContentType -> Microsoft.VisualStudio.Text.ITextBuffer
Public Function CreateTextBuffer (image As ITextImage, contentType As IContentType) As ITextBuffer

Parameters

image
ITextImage

The initial text of the buffer.

contentType
IContentType

The IContentType for the new ITextBuffer.

Returns

A ITextBuffer object with the given text and IContentType.

Exceptions

Either image 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(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)

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 = "");
abstract member CreateTextBuffer : System.IO.TextReader * Microsoft.VisualStudio.Utilities.IContentType * int64 * string -> Microsoft.VisualStudio.Text.ITextBuffer
Public Function CreateTextBuffer (reader As TextReader, contentType As IContentType, Optional length As Long = -1, Optional traceId As String = "") 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.

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