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

'宣言
Function GetLineData ( _
    iLine As Integer, _
    <OutAttribute> pLineData As LINEDATA(), _
    pMarkerData As MARKERDATA() _
) As Integer
'使用
Dim instance As IVsTextLines
Dim iLine As Integer
Dim pLineData As LINEDATA()
Dim pMarkerData As MARKERDATA()
Dim returnValue As Integer

returnValue = instance.GetLineData(iLine, _
    pLineData, pMarkerData)
int GetLineData(
    int iLine,
    LINEDATA[] pLineData,
    MARKERDATA[] pMarkerData
)
int GetLineData(
    [InAttribute] int iLine, 
    [OutAttribute] array<LINEDATA>^ pLineData, 
    [InAttribute] array<MARKERDATA>^ pMarkerData
)
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: []

    [in,out] The filled-in LINEDATA structure. This is allocated by the caller and filled in by the GetLineData method.

  • pMarkerData
    Type: []

    [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.

注意

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.

Permissions

See Also

Reference

IVsTextLines Interface

IVsTextLines Members

Microsoft.VisualStudio.TextManager.Interop Namespace