Class TextSpan
Represents a span in a text.
Implements
Inherited Members
Namespace: DevToys.Api
Assembly: DevToys.Api.dll
Syntax
public record TextSpan : IEquatable<TextSpan>
Constructors
TextSpan(int, int)
Initializes a new instance of the TextSpan class.
Declaration
public TextSpan(int startPosition, int length)
Parameters
Type | Name | Description |
---|---|---|
int | startPosition | The position at which the span starts. |
int | length | The length of the span. |
Properties
EndPosition
Gets the end position of the span.
Declaration
public int EndPosition { get; }
Property Value
Type | Description |
---|---|
int |
Length
Gets the length of the span.
Declaration
public int Length { get; }
Property Value
Type | Description |
---|---|
int |
StartPosition
Gets the position at which the span starts.
Declaration
public int StartPosition { get; }
Property Value
Type | Description |
---|---|
int |
Methods
FromBounds(int, int)
Creates a new TextSpan from the given start and end positions.
Declaration
public static TextSpan FromBounds(int start, int end)
Parameters
Type | Name | Description |
---|---|---|
int | start | The position at which the span starts. |
int | end | The position at which the span ends. |
Returns
Type | Description |
---|---|
TextSpan |