IVsTextLines.GetLineData Method
Provides direct, line-oriented access to the text buffer.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Syntax
'Declaration
Function GetLineData ( _
iLine As Integer, _
<OutAttribute> pLineData As LINEDATA(), _
pMarkerData As MARKERDATA() _
) As Integer
int GetLineData(
int iLine,
LINEDATA[] pLineData,
MARKERDATA[] pMarkerData
)
int GetLineData(
[InAttribute] int iLine,
[OutAttribute] array<LINEDATA>^ pLineData,
[InAttribute] array<MARKERDATA>^ pMarkerData
)
abstract GetLineData :
iLine:int *
pLineData:LINEDATA[] byref *
pMarkerData:MARKERDATA[] -> int
function GetLineData(
iLine : int,
pLineData : LINEDATA[],
pMarkerData : MARKERDATA[]
) : int
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.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.
Remarks
COM Signature
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.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.