Partager via


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

'Déclaration
Public Overridable Function GetLineData ( _
    iLine As Integer, _
    <OutAttribute> pLineData As LINEDATA(), _
    pMarkerData As MARKERDATA() _
) As Integer
public virtual int GetLineData(
    int iLine,
    LINEDATA[] pLineData,
    MARKERDATA[] pMarkerData
)
public:
virtual int GetLineData(
    [InAttribute] int iLine, 
    [OutAttribute] array<LINEDATA>^ pLineData, 
    [InAttribute] array<MARKERDATA>^ pMarkerData
)
abstract GetLineData : 
        iLine:int * 
        pLineData:LINEDATA[] byref * 
        pMarkerData:MARKERDATA[] -> int 
override GetLineData : 
        iLine:int * 
        pLineData:LINEDATA[] byref * 
        pMarkerData:MARKERDATA[] -> int 
public 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.

Implements

IVsTextLines.GetLineData(Int32, array<LINEDATA[], array<MARKERDATA[])

Remarks

When you call VsTextBufferClass.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

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

VsTextBufferClass Class

Microsoft.VisualStudio.TextManager.Interop Namespace