Partilhar via


SnapshotSpan Struct

Definition

An immutable text span in a particular text snapshot.

public value class SnapshotSpan
struct SnapshotSpan
public struct SnapshotSpan
type SnapshotSpan = struct
Public Structure SnapshotSpan
Inheritance
SnapshotSpan

Constructors

SnapshotSpan(ITextSnapshot, Int32, Int32)

Initializes a new instance of a SnapshotSpan with the specified snapshot, start point, and length.

SnapshotSpan(ITextSnapshot, Span)

Initializes a new instance of a SnapshotSpan with the specified snapshot and span.

SnapshotSpan(SnapshotPoint, Int32)

Initializes a new instance of a SnapshotSpan from an existing SnapshotPoint and a specified length.

SnapshotSpan(SnapshotPoint, SnapshotPoint)

Initializes a new instance of a SnapshotSpan from two SnapshotPoint objects.

Properties

End

Gets the end of the snapshot span. The span is open-ended on the right side, which is to say that Start + Length = End.

IsEmpty

Determines whether or not this span is empty.

Length

Gets the length of the span, which is always non-negative.

Snapshot

The ITextSnapshot to which this snapshot span refers.

Span

Gets the span covered by the snapshot span.

Start

Gets the starting index of the snapshot span.

Methods

Contains(Int32)

Determines whether the position lies within the span.

Contains(SnapshotPoint)

Determines whether a given SnapshotPoint lies within the span.

Contains(SnapshotSpan)

Determines whether snapshotSpan falls completely within this span.

Contains(Span)

Determines whether simpleSpan falls completely within this span.

Equals(Object)

Determines whether two snapshot spans are the same.

GetHashCode()

Serves as a hash function for this type.

GetText()

The text contained by this snapshot span.

Intersection(SnapshotSpan)

Computes the intersection with the given SnapshotSpan, or null if there is no intersection.

Intersection(Span)

Computes the intersection with the given span, or null if there is no intersection.

IntersectsWith(SnapshotSpan)

Determines whether snapshotSpan intersects this span. Two spans are considered to intersect if they have positions in common, or the end of one span coincides with the start of the other span, and neither is empty.

IntersectsWith(Span)

Determines whether simpleSpan intersects this span. Two spans are considered to intersect if they have positions in common, or if the end of one span coincides with the start of the other span, and neither is empty.

Overlap(SnapshotSpan)

Returns the overlap with the given SnapshotSpan, or null if there is no overlap.

Overlap(Span)

Returns the overlap with the given span, or null if there is no overlap.

OverlapsWith(SnapshotSpan)

Determines whether snapshotSpan overlaps this span. Two spans are considered to overlap if they have positions in common and are not empty. Empty spans do not overlap with any other span.

OverlapsWith(Span)

Determines whether simpleSpan overlaps this span. Two spans are considered to overlap if they have positions in common and are not empty. Empty spans do not overlap with any other span.

ToString()

Converts this snapshot span to a string, or to the string "uninit" if the ITextSnapshot is null.

TranslateTo(ITextSnapshot, SpanTrackingMode)

Translates this snapshot span to a different snapshot of the same ITextBuffer.

Operators

Equality(SnapshotSpan, SnapshotSpan)

Determines whether two snapshot spans are the same.

Implicit(SnapshotSpan to Span)

Implicitly converts a snapshot span to a span.

Inequality(SnapshotSpan, SnapshotSpan)

Determines whether two snapshot spans are different.

Applies to