Compartir a través de


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

'Declaración
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.

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

See Also

Reference

IVsTextLines Interface

Microsoft.VisualStudio.TextManager.Interop Namespace