ITextSnapshot.GetText Method

Definition

Overloads

GetText(Int32, Int32)

Gets text from the snapshot starting at startIndex and having length equal to length.

GetText()

Gets all the text in the snapshot.

GetText(Span)

Gets text from the snapshot starting at the beginning of the span and having length equal to the length of the span.

GetText(Int32, Int32)

Gets text from the snapshot starting at startIndex and having length equal to length.

public:
 System::String ^ GetText(int startIndex, int length);
public:
 Platform::String ^ GetText(int startIndex, int length);
std::wstring GetText(int startIndex, int length);
public string GetText (int startIndex, int length);
abstract member GetText : int * int -> string
Public Function GetText (startIndex As Integer, length As Integer) As String

Parameters

startIndex
Int32

The starting index.

length
Int32

The length of text to get.

Returns

The string of length length starting at startIndex in the underlying ITextBuffer.

Exceptions

startIndex is less than zero or greater than the length of the snapshot, or length is less than zero, or startIndex plus length is greater than the length of the snapshot.

Applies to

GetText()

Gets all the text in the snapshot.

public:
 System::String ^ GetText();
public:
 Platform::String ^ GetText();
std::wstring GetText();
public string GetText ();
abstract member GetText : unit -> string
Public Function GetText () As String

Returns

A non-null string.

Applies to

GetText(Span)

Gets text from the snapshot starting at the beginning of the span and having length equal to the length of the span.

public:
 System::String ^ GetText(Microsoft::VisualStudio::Text::Span span);
public:
 Platform::String ^ GetText(Microsoft::VisualStudio::Text::Span span);
std::wstring GetText(Microsoft::VisualStudio::Text::Span span);
public string GetText (Microsoft.VisualStudio.Text.Span span);
abstract member GetText : Microsoft.VisualStudio.Text.Span -> string
Public Function GetText (span As Span) As String

Parameters

span
Span

The span to return.

Returns

A non-null string.

Exceptions

The end of the span is greater than Length.

Applies to