Click or drag to resize

TextSpan Class



Immutable abstract representation of a span of text. For example, in an error diagnostic that reports a location, it could come from a parsed string, text from a tool editor buffer, etc.
Inheritance Hierarchy
SystemValueType
  Microsoft.CodeAnalysis.TextTextSpan

Namespace:  Microsoft.CodeAnalysis.Text
Assembly:  Microsoft.CodeAnalysis (in Microsoft.CodeAnalysis.dll) Version: 2.3.0-dev-56735-00. Commit Hash: <developer build>
Syntax
public sealed class TextSpan : ValueType, 
	IEquatable, IComparable

The TextSpan type exposes the following members.

Constructors
  NameDescription
Public methodTextSpan
Creates a TextSpan instance beginning with the position Start and having the Length specified with length.
Top
Properties
  NameDescription
Public propertyEnd
End of the span.
Public propertyIsEmpty
Determines whether or not the span is empty.
Public propertyLength
Length of the span.
Public propertyStart
Start point of the span.
Top
Methods
  NameDescription
Public methodCompareTo
Compares current instance of TextSpan with another.
Public methodContains(Int32)
Determines whether the position lies within the span.
Public methodContains(TextSpan)
Determines whether span falls completely within this span.
Public methodEquals(Object)
Determines if current instance of TextSpan is equal to another.
Public methodEquals(TextSpan)
Determines if current instance of TextSpan is equal to another.
Public methodStatic memberFromBounds
Creates a new TextSpan from start and end positions as opposed to a position and length. The returned TextSpan contains the range with start inclusive, and end exclusive.
Public methodGetHashCode
Produces a hash code for TextSpan.
Public methodIntersection
Public methodIntersectsWith(Int32)
Determines whether position intersects this span. A position is considered to intersect if it is between the start and end positions (inclusive) of this span.
Public methodIntersectsWith(TextSpan)
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.
Public methodOverlap
Public methodOverlapsWith
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.
Public methodToString
Provides a string representation for TextSpan.
Top
Operators
  NameDescription
Public operatorStatic memberEquality
Determines if two instances of TextSpan are the same.
Public operatorStatic memberInequality
Determines if two instances of TextSpan are different.
Top
See Also