Struct TextChangeRange
Represents the change to a span of text.
Implements
IEquatable<TextChangeRange>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Loretta.CodeAnalysis.Text
Assembly: Loretta.CodeAnalysis.dll
Syntax
public readonly struct TextChangeRange
Constructors
| Improve this Doc View SourceTextChangeRange(TextSpan, Int32)
Initializes a new instance of TextChangeRange.
Declaration
public TextChangeRange(TextSpan span, int newLength)
Parameters
Type | Name | Description |
---|---|---|
TextSpan | span | |
System.Int32 | newLength |
Properties
| Improve this Doc View SourceNewLength
Width of the span after the edit. A 0 here would represent a delete
Declaration
public readonly int NewLength { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NoChanges
An empty set of changes.
Declaration
public static readonly IReadOnlyList<TextChangeRange> NoChanges { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<TextChangeRange> |
Span
The span of text before the edit which is being changed
Declaration
public readonly TextSpan Span { get; }
Property Value
Type | Description |
---|---|
TextSpan |
Methods
| Improve this Doc View SourceCollapse(IEnumerable<TextChangeRange>)
Collapse a set of TextChangeRanges into a single encompassing range. If the set of ranges provided is empty, an empty range is returned.
Declaration
public static TextChangeRange Collapse(IEnumerable<TextChangeRange> changes)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TextChangeRange> | changes |
Returns
Type | Description |
---|---|
TextChangeRange |
Equals(TextChangeRange)
Compares current instance of TextChangeRange to another.
Declaration
public readonly bool Equals(TextChangeRange other)
Parameters
Type | Name | Description |
---|---|---|
TextChangeRange | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Compares current instance of TextChangeRange to another.
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
System.ValueType.Equals(System.Object)
|
Improve this Doc
View Source
GetHashCode()
Provides hash code for current instance of TextChangeRange.
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.ValueType.GetHashCode()
|
Improve this Doc
View Source
ToString()
Converts the text change range to a string.
Declaration
public override readonly string ToString()
Returns
Type | Description |
---|---|
System.String |
Overrides
System.ValueType.ToString()
Operators
| Improve this Doc View SourceEquality(TextChangeRange, TextChangeRange)
Determines if two instances of TextChangeRange are same.
Declaration
public static bool operator ==(TextChangeRange left, TextChangeRange right)
Parameters
Type | Name | Description |
---|---|---|
TextChangeRange | left | |
TextChangeRange | right |
Returns
Type | Description |
---|---|
System.Boolean |
Inequality(TextChangeRange, TextChangeRange)
Determines if two instances of TextChangeRange are different.
Declaration
public static bool operator !=(TextChangeRange left, TextChangeRange right)
Parameters
Type | Name | Description |
---|---|---|
TextChangeRange | left | |
TextChangeRange | right |
Returns
Type | Description |
---|---|
System.Boolean |
Implements
IEquatable<>