MethodData.GetContextStream(Int32, Int32) Method

Definition

Converts the current context span to a file position and length.

public:
 virtual int GetContextStream([Runtime::InteropServices::Out] int % pos, [Runtime::InteropServices::Out] int % length);
int GetContextStream([Runtime::InteropServices::Out] int & pos, [Runtime::InteropServices::Out] int & length);
public int GetContextStream (out int pos, out int length);
abstract member GetContextStream : int * int -> int
override this.GetContextStream : int * int -> int
Public Function GetContextStream (ByRef pos As Integer, ByRef length As Integer) As Integer

Parameters

pos
Int32

[out] Returns the position in the source file that corresponds to the start of the context span.

length
Int32

[out] Returns the length of the span.

Returns

If successful, returns S_OK; otherwise, returns an error code.

Implements

Remarks

This method converts the TextSpan object that was passed to the Refresh method into a file or stream position and length. The position in this case is a character offset from the beginning of the file.

The base method uses the GetNearestPosition method on the IVsTextView object (that was passed to the Refresh method) to convert the starting line/character offset and ending line/character offset to file positions and then returns the starting file position and the difference between the two positions as the length. This method throws a COMException exception if there were any errors and always returns a success code of S_OK.

This method is an implementation of the GetContextStream method on the IVsMethodData interface.

Applies to