ITextSnapshot.GetText 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
| GetText(Int32, Int32) | Gets text from the snapshot starting at  | 
| 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 -> stringPublic Function GetText (startIndex As Integer, length As Integer) As StringParameters
- 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 -> stringPublic Function GetText () As StringReturns
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 -> stringPublic Function GetText (span As Span) As StringParameters
- span
- Span
The span to return.
Returns
A non-null string.
Exceptions
The end of the span is greater than Length.