TextChange Struct

Represents a text replacement applied to a SourceText or to a syntax tree.

public readonly struct TextChange : IEquatable<TextChange>

Example

var tree = XmlSyntaxTree.ParseText("<version>1.0.0</version>");

// Replace the 5 characters starting at offset 9 ("1.0.0")
var change = new TextChange(new TextSpan(9, 5), "2.0.0");
var updated = tree.WithChanges(change);
Assert.Equal("<version>2.0.0</version>", updated.GetText().Text);
Implements

Constructors

NameDescription
TextChange(TextSpan, string)

TextChange(TextSpan, string)

TextChange.cs
public TextChange(TextSpan span, string newText)

Parameters

span TextSpan
newText string

No documentation is available.

Properties

NameDescription
NewText
Span
public string NewText { get; }

Property value

string

No documentation is available.

public TextSpan Span { get; }

Property value

TextSpan

No documentation is available.

Methods

NameDescription
Equals(TextChange)
Equals(object?)
GetHashCode()
ToString()

Equals overloads

Equals(TextChange)

TextChange.cs
public bool Equals(TextChange other)
Parameters
other TextChange
Returns

bool

No documentation is available.

Equals(object?)

TextChange.cs
public override bool Equals(object? obj)
Parameters
obj object?
Returns

bool

No documentation is available.

GetHashCode()

TextChange.cs
public override int GetHashCode()

Returns

int

No documentation is available.

ToString()

TextChange.cs
public override string ToString()

Returns

string

No documentation is available.

Operators

NameDescription
operator ==(TextChange, TextChange)
operator !=(TextChange, TextChange)

operator ==(TextChange, TextChange)

TextChange.cs
public static bool operator ==(TextChange left, TextChange right)

Parameters

left TextChange
right TextChange

Returns

bool

No documentation is available.

operator !=(TextChange, TextChange)

TextChange.cs
public static bool operator !=(TextChange left, TextChange right)

Parameters

left TextChange
right TextChange

Returns

bool

No documentation is available.