Partager via


Source.GetText Method (Int32, Int32, Int32, Int32)

Gets the text between the specified locations.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)

Syntax

'Declaration
Public Function GetText ( _
    startLine As Integer, _
    startCol As Integer, _
    endLine As Integer, _
    endCol As Integer _
) As String
public string GetText(
    int startLine,
    int startCol,
    int endLine,
    int endCol
)
public:
String^ GetText(
    int startLine, 
    int startCol, 
    int endLine, 
    int endCol
)
member GetText : 
        startLine:int * 
        startCol:int * 
        endLine:int * 
        endCol:int -> string
public function GetText(
    startLine : int, 
    startCol : int, 
    endLine : int, 
    endCol : int
) : String

Parameters

  • startLine
    Type: Int32

    The first line of text to obtain.

  • startCol
    Type: Int32

    The offset on the first line to the first character to obtain.

  • endLine
    Type: Int32

    The last line of text to obtain.

  • endCol
    Type: Int32

    The offset on the last line to the last character to obtain.

Return Value

Type: String
The desired text. This can be an empty string.

Remarks

This method forwards the call to the GetLineText method on the IVsTextLines object passed to the Source class constructor. This method throws an exception if GetLineText returns an error.

.NET Framework Security

See Also

Reference

Source Class

GetText Overload

Microsoft.VisualStudio.Package Namespace