Partager via


Source.GetTextUpToLine(Int32) Method

Definition

Gets the text from the source up to and including the given line number.

public:
 System::String ^ GetTextUpToLine(int line);
public:
 Platform::String ^ GetTextUpToLine(int line);
std::wstring GetTextUpToLine(int line);
public string GetTextUpToLine (int line);
member this.GetTextUpToLine : int -> string
Public Function GetTextUpToLine (line As Integer) As String

Parameters

line
Int32

The line number of the last line of text to obtain. Specify 0 to obtain all the text in the source.

Returns

All the text up to and including the given line.

Remarks

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.

Applies to