Share via


ITextSnapshot.GetText Method (Int32, Int32)

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

Namespace:  Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

'Declaration
Function GetText ( _
    startIndex As Integer, _
    length As Integer _
) As String
string GetText(
    int startIndex,
    int length
)
String^ GetText(
    int startIndex, 
    int length
)
abstract GetText : 
        startIndex:int * 
        length:int -> string
function GetText(
    startIndex : int, 
    length : int
) : String

Parameters

  • startIndex
    Type: Int32

    The starting index.

  • length
    Type: Int32

    The length of text to get.

Return Value

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

Exceptions

Exception Condition
ArgumentOutOfRangeException

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.

.NET Framework Security

See Also

Reference

ITextSnapshot Interface

GetText Overload

Microsoft.VisualStudio.Text Namespace