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.

C#
public static int operator -(Microsoft.VisualStudio.Extensibility.Editor.TextPosition start, Microsoft.VisualStudio.Extensibility.Editor.TextPosition other);

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

Visual Studio SDK 2022
Produkt Wersje
Visual Studio SDK 2022

Subtraction(TextPosition, Int32)

Decrements the position of a snapshot position.

C#
public static Microsoft.VisualStudio.Extensibility.Editor.TextPosition operator -(Microsoft.VisualStudio.Extensibility.Editor.TextPosition position, int offset);

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

Visual Studio SDK 2022
Produkt Wersje
Visual Studio SDK 2022