Span Structure

Represents a range.

Namespace:  Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

Syntax

声明
Public Structure Span
public struct Span
public value class Span
[<Sealed>]
type Span =  struct end
JScript supports the use of structures, but not the declaration of new ones.

The Span type exposes the following members.

Constructors

  Name Description
Public method Span Initializes a new instance of a Span with the given start point and length.

Top

Properties

  Name Description
Public property End Gets the end of the span.
Public property IsEmpty Determines whether or not this span is empty.
Public property Length Gets the length of the span, which is always non-negative.
Public property Start Gets the starting index of the span.

Top

Methods

  Name Description
Public method Contains(Int32) Determines whether the position lies within the span.
Public method Contains(Span) Determines whether the specified span falls completely within this span.
Public method Equals Determines whether two spans are the same. (Overrides ValueType.Equals(Object).)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic member FromBounds Initializes a new instance of a Span with the given start and end positions.
Public method GetHashCode Provides a hash function for the type. (Overrides ValueType.GetHashCode().)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method Intersection Gets the intersection with the given span, or null if there is no intersection.
Public method IntersectsWith Determines whether span intersects this span.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method Overlap Gets the overlap with the specified span.
Public method OverlapsWith Determines whether the specified span overlaps this span.
Public method ToString Provides a string representation of the span. (Overrides ValueType.ToString().)

Top

Operators

  Name Description
Public operatorStatic member Equality Determines whether two spans are the same.
Public operatorStatic member Inequality Determines whether two spans are different.

Top

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.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Text Namespace