TextSpan Struct
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.
public value class TextSpan : IComparable<Microsoft::CodeAnalysis::Text::TextSpan>, IEquatable<Microsoft::CodeAnalysis::Text::TextSpan>
public readonly struct TextSpan : IComparable<Microsoft.CodeAnalysis.Text.TextSpan>, IEquatable<Microsoft.CodeAnalysis.Text.TextSpan>
[System.Runtime.Serialization.DataContract]
public readonly struct TextSpan : IComparable<Microsoft.CodeAnalysis.Text.TextSpan>, IEquatable<Microsoft.CodeAnalysis.Text.TextSpan>
type TextSpan = struct
[<System.Runtime.Serialization.DataContract>]
type TextSpan = struct
Public Structure TextSpan
Implements IComparable(Of TextSpan), IEquatable(Of TextSpan)
- Inheritance
-
TextSpan
- Attributes
- Implements
Constructors
TextSpan(Int32, Int32) |
Creates a TextSpan instance beginning with the position Start and having the Length
specified with |
Properties
End |
End of the span. |
IsEmpty |
Determines whether or not the span is empty. |
Length |
Length of the span. |
Start |
Start point of the span. |
Methods
CompareTo(TextSpan) |
Compares current instance of TextSpan with another. |
Contains(Int32) |
Determines whether the position lies within the span. |
Contains(TextSpan) |
Determines whether |
Equals(Object) |
Determines if current instance of TextSpan is equal to another. |
Equals(TextSpan) |
Determines if current instance of TextSpan is equal to another. |
FromBounds(Int32, Int32) |
Creates a new TextSpan from The returned TextSpan contains the range with |
GetHashCode() |
Produces a hash code for TextSpan. |
Intersection(TextSpan) |
Returns the intersection with the given span, or null if there is no intersection. |
IntersectsWith(Int32) |
Determines whether |
IntersectsWith(TextSpan) |
Determines whether |
Overlap(TextSpan) |
Returns the overlap with the given span, or null if there is no overlap. |
OverlapsWith(TextSpan) |
Determines whether |
ToString() |
Provides a string representation for TextSpan.
This representation uses "half-open interval" notation, indicating the endpoint character is not included.
Example: |
Operators
Equality(TextSpan, TextSpan) |
Determines if two instances of TextSpan are the same. |
Inequality(TextSpan, TextSpan) |
Determines if two instances of TextSpan are different. |