TextSnapshotOffset Struct
Represents a zero-based offset value within a certain ITextSnapshot.
public struct TextSnapshotOffset : ITextRangeProvider
- Implements:
- ITextRangeProvider
Constructors
TextSnapshotOffset(ITextSnapshot, int)
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 | int | 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
- int:
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
- bool:
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.
Position
Gets 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
- int:
A 32-bit signed integer that indicates the relative order of the comparands.
CompareTo(int)
Compares the current instance with another object of the same type.
public int CompareTo(int value)
Parameter | Type | Description |
---|---|---|
value | int | An offset to compare with this instance. |
Returns
- int:
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 |
Returns
- bool:
true
if the specifiedObject
is equal to the currentObject
; otherwise,false
.
GetHashCode()
Returns a hash code for this object.
public override int GetHashCode()
Returns
- int:
An integer value that specifies a hash value for this object.
ToString()
Converts the object to a String
.
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
operator ==(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
operator >(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
- bool:
true
if the TextSnapshotOffset inleft
is greater than the TextSnapshotOffset inright
; otherwise,false
.
implicit operator int(TextSnapshotOffset)
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
- int:
The integer offset result.
operator !=(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
operator <(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
- bool:
true
if the TextSnapshotOffset inleft
is less than the TextSnapshotOffset inright
; otherwise,false
.