Source.GetText Method

Gets all of the text of the source file.

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 As String
public string GetText()
public:
String^ GetText()
member GetText : unit -> string
public function GetText() : String

Return Value

Type: String
The entire source file.

Remarks

Use this method to access the entire source file as a single block of text.

This method calls the GetLastLineIndex method on the IVsTextLines object passed to the Source class constructor, and then returns the result of calling GetText(Int32, Int32, Int32, Int32) with the start and ending location of the source file. This method throws an exception if GetLastLineIndex returns an error.

.NET Framework Security

See Also

Reference

Source Class

GetText Overload

Microsoft.VisualStudio.Package Namespace