Source::GetTextUpToLine Method (Int32)
Visual Studio 2015
Gets the text from the source up to and including the given line number.
Assembly: Microsoft.VisualStudio.Package.LanguageService.14.0 (in Microsoft.VisualStudio.Package.LanguageService.14.0.dll)
Parameters
- line
-
Type:
System::Int32
The line number of the last line of text to obtain. Specify 0 to obtain all the text in the source.
This method calls the GetLastLineIndex method on the IVsTextLines object passed to the Source class constructor to get the total number of lines. If line is 0, use the total number of lines (minus 1) as the last line; otherwise, use line if it does not exceed the total number of lines. Finally, get the length of the last line to obtain (with a call to GetLengthOfLine), and return the result from a call to GetText(Int32, Int32, Int32, Int32). This method throws an exception if either GetLastLineIndex or GetLengthOfLine return errors.
Show: