Compartilhar via


Span Struct

Definition

An immutable integer interval that describes a range of values from Start to End that is closed on the left and open on the right: [Start .. End). A span is usually applied to an ITextSnapshot to denote a span of text, but it is independent of any particular text buffer or snapshot.

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

Remarks

This structure represents an immutable integer interval that describes a range of values, from Start to End. It is closed on the left and open on the right: [Start .. End). In the context of an ITextSnapshot it represents a span of text, but the span structure itself is independent of any particular text buffer or snapshot.

Constructors

Span(Int32, Int32)

Initializes a new instance of a Span with the given start point and length.

Properties

End

The end of the 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

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

Start

The starting index of the span.

Methods

Contains(Int32)

Determines whether the position lies within the span.

Contains(Span)

Determines whether span falls completely within this span.

Equals(Object)

Determines whether two spans are the same.

FromBounds(Int32, Int32)

Initializes a new instance of a Span with the given start and end positions.

GetHashCode()

Provides a hash function for the type.

Intersection(Span)

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

IntersectsWith(Span)

Determines whether span 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.

Overlap(Span)

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

OverlapsWith(Span)

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

ToString()

Provides a string representation of the span.

Operators

Equality(Span, Span)

Determines whether two spans are the same

Inequality(Span, Span)

Determines whether two spans are different.

Applies to