In This Article

TextSnapshotOffset Struct

Represents a zero-based offset value within a certain ITextSnapshot.

public struct TextSnapshotOffset : ITextRangeProvider
Implements:
ITextRangeProvider

Constructors

TextSnapshotOffset(ITextSnapshot, Int32)

Initializes a new instance of the TextSnapshotOffset class with the specified offset.

public TextSnapshotOffset(ITextSnapshot snapshot, int offset)
Parameter Type Description
snapshot ITextSnapshot

The ITextSnapshot that contains the offset.

offset Int32

The zero-based offset.

Properties

Column

Gets the zero-based column value, which accounts for the document's tab size.

public int Column { get; }

Property Value

Int32:

The zero-based column value, which accounts for the document's tab size.

Deleted

Gets a TextSnapshotOffset that has no Snapshot and is flagged as deleted.

public static TextSnapshotOffset Deleted { get; }

Property Value

TextSnapshotOffset:

A TextSnapshotOffset that has no Snapshot and is flagged as deleted.

IsDeleted

Gets whether the offset has been flagged as deleted.

public bool IsDeleted { get; }

Property Value

Boolean:

true if the offset has been flagged as deleted; otherwise, false.

Line

Gets the ITextSnapshotLine that contains the offset.

public ITextSnapshotLine Line { get; }

Property Value

ITextSnapshotLine:

The ITextSnapshotLine that contains the offset.

Offset

Gets the zero-based offset value.

public int Offset { get; }

Property Value

Int32:

The zero-based offset value.

Position

Gets the TextPosition for the offset.

public TextPosition Position { get; }

Property Value

TextPosition:

The TextPosition for the offset.

Snapshot

Gets the ITextSnapshot that contains the offset.

public ITextSnapshot Snapshot { get; }

Property Value

ITextSnapshot:

The ITextSnapshot that contains the offset.

Methods

CompareTo(TextSnapshotOffset)

Compares the current instance with another object of the same type.

public int CompareTo(TextSnapshotOffset snapshotOffset)
Parameter Type Description
snapshotOffset TextSnapshotOffset

A TextSnapshotOffset to compare with this instance.

Returns

Int32:

A 32-bit signed integer that indicates the relative order of the comparands.

CompareTo(Int32)

Compares the current instance with another object of the same type.

public int CompareTo(int value)
Parameter Type Description
value Int32

An offset to compare with this instance.

Returns

Int32:

A 32-bit signed integer that indicates the relative order of the comparands.

Equals(Object)

Determines whether the specified Object is equal to the current Object.

public override bool Equals(object obj)
Parameter Type Description
obj Object

The Object to compare to the current Object.

Returns

Boolean:

true if the specified Object is equal to the current Object; otherwise, false.

GetHashCode()

Returns a hash code for this object.

public override int GetHashCode()

Returns

Int32:

An integer value that specifies a hash value for this object.

ToString()

Converts the object to a String.

public override string ToString()

Returns

String:

A string whose value represents this object.

TranslateTo(ITextSnapshot, TextOffsetTrackingMode)

Translates this offset from one ITextSnapshot to another in the same ITextDocument.

public TextSnapshotOffset TranslateTo(ITextSnapshot toSnapshot, TextOffsetTrackingMode trackingMode)
Parameter Type Description
toSnapshot ITextSnapshot

The ITextSnapshot that is the target of the translation.

trackingMode TextOffsetTrackingMode

A TextOffsetTrackingMode indicating the tracking mode to use.

Returns

TextSnapshotOffset:

The translated TextSnapshotOffset.

Operators

Equality(TextSnapshotOffset, TextSnapshotOffset)

Compares two TextSnapshotOffset objects. The result specifies whether the values of the Offset properties of the two TextSnapshotOffset objects are equal.

public static bool operator ==(TextSnapshotOffset left, TextSnapshotOffset right)
Parameter Type Description
left TextSnapshotOffset

A TextSnapshotOffset to compare.

right TextSnapshotOffset

A TextSnapshotOffset to compare.

Returns

Boolean:

true if the Offset values of left and right are equal; otherwise, false.

GreaterThan(TextSnapshotOffset, TextSnapshotOffset)

Compares whether one TextSnapshotOffset is greater than the other.

public static bool operator>(TextSnapshotOffset left, TextSnapshotOffset right)
Parameter Type Description
left TextSnapshotOffset

A TextSnapshotOffset to compare.

right TextSnapshotOffset

A TextSnapshotOffset to compare.

Returns

Boolean:

true if the TextSnapshotOffset in left is greater than the TextSnapshotOffset in right; otherwise, false.

Implicit(TextSnapshotOffset to Int32)

Implicitly converts a TextSnapshotOffset instance to an integer offset.

public static implicit operator int (TextSnapshotOffset snapshotOffset)
Parameter Type Description
snapshotOffset TextSnapshotOffset

The TextSnapshotOffset to convert.

Returns

Int32:

The integer offset result.

Inequality(TextSnapshotOffset, TextSnapshotOffset)

Compares two TextSnapshotOffset objects. The result specifies whether the values of the Offset properties of the two TextSnapshotOffset objects are unequal.

public static bool operator !=(TextSnapshotOffset left, TextSnapshotOffset right)
Parameter Type Description
left TextSnapshotOffset

A TextSnapshotOffset to compare.

right TextSnapshotOffset

A TextSnapshotOffset to compare.

Returns

Boolean:

true if the Offset values of left and right are unequal; otherwise, false.

LessThan(TextSnapshotOffset, TextSnapshotOffset)

Compares whether one TextSnapshotOffset is less than the other.

public static bool operator <(TextSnapshotOffset left, TextSnapshotOffset right)
Parameter Type Description
left TextSnapshotOffset

A TextSnapshotOffset to compare.

right TextSnapshotOffset

A TextSnapshotOffset to compare.

Returns

Boolean:

true if the TextSnapshotOffset in left is less than the TextSnapshotOffset in right; otherwise, false.

Explicit Interface Implementations

ITextRangeProvider.TextRange

Gets or sets a TextRange that specifies the text range of the object.

TextRange ITextRangeProvider.TextRange { get; set; }

Returns

TextRange:

A TextRange that specifies the text range of the object.

Inherited Members