IVsTextLines::GetLineData Method (Int32, array<LINEDATA>^, array<MARKERDATA>^)
Provides direct, line-oriented access to the text buffer.
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Parameters
- iLine
-
Type:
System::Int32
[in] Buffer line to access. This is a zero-based value.
- pLineData
-
Type:
array<Microsoft.VisualStudio.TextManager.Interop::LINEDATA>^
[in,out] The filled-in LINEDATA structure. This is allocated by the caller and filled in by the GetLineData method.
- pMarkerData
-
Type:
array<Microsoft.VisualStudio.TextManager.Interop::MARKERDATA>^
[in, optional] MARKERDATA structure. Use GetMarkerData to fill the MARKERDATA structure for the line range that you specify. If you want syntax coloring and marker attributes to return in the LINEDATA structure (pLineData), then you need to pass in this parameter.
Return Value
Type: System::Int32If the method succeeds, it returns S_OK. If it fails, it returns an error code.
From textmgr.idl:
HRESULT IVsTextLines::GetLineData( [in] long iLine, [out] LINEDATA *pLineData, [in] MARKERDATA *pMarkerData );
When you call IVsTextLines.GetLineData you are provided with a pointer into the buffer's internal data. You can only use this method to access one line in the buffer at a time.
This method returns data for the line in a LINEDATA structure, and can be used to quickly probe the contents of a buffer. If you want to read text line-by-line, it is much faster to get and read LINEDATA than to call the methods CopyLineText or GetLineText.
Note |
|---|
IVsTextLines.GetLineData uses pointers to the buffer's internal data. The buffer is frozen until the ReleaseLineData method is called. Any successful call to GetLineData must call ReleaseLineData with the same LINEDATA pointer. The parameter pMarkerData, if non-null, indicates that attribute data is also requested. The pMarkerData given must be obtained by a previous call to the GetMarkerData method. |
