IVsTextLines.GetMarkerData Method
Returns text marker data for the specified line range within the text buffer.
Namespace: Microsoft.VisualStudio.TextManager.Interop
Assembly: Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)
Syntax
'Declaration
Function GetMarkerData ( _
iTopLine As Integer, _
iBottomLine As Integer, _
<OutAttribute> pMarkerData As MARKERDATA() _
) As Integer
'Usage
Dim instance As IVsTextLines
Dim iTopLine As Integer
Dim iBottomLine As Integer
Dim pMarkerData As MARKERDATA()
Dim returnValue As Integer
returnValue = instance.GetMarkerData(iTopLine, _
iBottomLine, pMarkerData)
int GetMarkerData(
int iTopLine,
int iBottomLine,
MARKERDATA[] pMarkerData
)
int GetMarkerData(
[InAttribute] int iTopLine,
[InAttribute] int iBottomLine,
[OutAttribute] array<MARKERDATA>^ pMarkerData
)
abstract GetMarkerData :
iTopLine:int *
iBottomLine:int *
pMarkerData:MARKERDATA[] byref -> int
function GetMarkerData(
iTopLine : int,
iBottomLine : int,
pMarkerData : MARKERDATA[]
) : int
Parameters
- iTopLine
Type: System.Int32
[in] Top line of the marker data.
- iBottomLine
Type: System.Int32
[in] Bottom line of the marker data.
- pMarkerData
Type: array<Microsoft.VisualStudio.TextManager.Interop.MARKERDATA[]
[out] Pointer to filled MARKERDATA structure for the range indicated.
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::GetMarkerData(
[in] long iTopLine,
[in] long iBottomLine,
[out] MARKERDATA *pMarkerData
);
Use this method with GetLineData to determine the marker data for a given range in the text buffer. After you call IVsTextLines.GetMarkerData, you then need to call ReleaseMarkerData to allow the text buffer to clean up the MARKERDATA structure.
GetMarkerData in Managed Code
GetMarkerData can cause problems in managed code. The GetMarkerData implementation that you do not Release the pLayer member. Thus, it does not perform an AddRef on the interface. There is no problem in native C++ so long as you do not call Release In managed code you cannot control when a Release is done. To be safe, you should do an AddRef on the pLayer member after GetMarkerData fills in the data structure. The simplest way to do this is with GetIUnknownForObject:
[C#]
MARKERDATA[] markerData = new MARKERDATA[1];
markerData[0] = new Microsoft.VisualStudio.TextManager.Interop.MARKERDATA();
buffer.GetMarkerData(line, line, markerData);
IntPtr dummyAddRef = Marshal.GetIUnknownForObject(markerData[0].pLayer);
.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.