ITextBufferFactoryService2.CreateTextBuffer Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CreateTextBuffer(SnapshotSpan, IContentType) |
Creates an ITextBuffer with the specified IContentType and populates it
with the given text contained in |
CreateTextBuffer(TextReader, IContentType, Int64, String, Boolean) |
Creates an ITextBuffer with the given |
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.
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
The reader
is not closed by this operation.
The length
is used to help select a storage strategy for the text buffer.