Partager via


TextPosition.Subtraction Operator

Definition

Overloads

Subtraction(TextPosition, TextPosition)

Computes the offset between two TextPosition objects.

Subtraction(TextPosition, Int32)

Decrements the position of a snapshot position.

Subtraction(TextPosition, TextPosition)

Computes the offset between two TextPosition objects.

public static int operator - (Microsoft.VisualStudio.Extensibility.Editor.TextPosition start, Microsoft.VisualStudio.Extensibility.Editor.TextPosition other);
static member ( - ) : Microsoft.VisualStudio.Extensibility.Editor.TextPosition * Microsoft.VisualStudio.Extensibility.Editor.TextPosition -> int
Public Shared Operator - (start As TextPosition, other As TextPosition) As Integer

Parameters

start
TextPosition

The starting position.

other
TextPosition

The position from which to compute the offset.

Returns

The offset between the two positions, equivalent to start.Offset - other.Offset.

Exceptions

The two positions do not belong to the same snapshot.

Remarks

The following should always be true: start == other + (start - other).

Applies to

Subtraction(TextPosition, Int32)

Decrements the position of a snapshot position.

public static Microsoft.VisualStudio.Extensibility.Editor.TextPosition operator - (Microsoft.VisualStudio.Extensibility.Editor.TextPosition position, int offset);
static member ( - ) : Microsoft.VisualStudio.Extensibility.Editor.TextPosition * int -> Microsoft.VisualStudio.Extensibility.Editor.TextPosition
Public Shared Operator - (position As TextPosition, offset As Integer) As TextPosition

Parameters

position
TextPosition

The position from which to calculate the new position.

offset
Int32

The offset of the new position.

Returns

Exceptions

The new position is less than zero or greater than Snapshot.Length.

Applies to