TextDiffEntry Struct

public readonly struct TextDiffEntry : IEquatable<TextDiffEntry>

No documentation is available.

Implements

Constructors

NameDescription
TextDiffEntry(TextDiffOperation, string)
TextDiffEntry(TextDiffOperation, string?, string?)
TextDiffEntry(TextDiffOperation, string?, string?, int?)Initializes a new entry that belongs to a moved block.

TextDiffEntry overloads

TextDiffEntry(TextDiffOperation, string)

TextDiffEntry.cs
public TextDiffEntry(TextDiffOperation operation, string text)
Parameters
operation TextDiffOperation
text string

No documentation is available.

TextDiffEntry(TextDiffOperation, string?, string?)

TextDiffEntry.cs
public TextDiffEntry(TextDiffOperation operation, string? oldText, string? newText)
Parameters
operation TextDiffOperation
oldText string?
newText string?

No documentation is available.

TextDiffEntry(TextDiffOperation, string?, string?, int?)

TextDiffEntry.cs

Initializes a new entry that belongs to a moved block.

public TextDiffEntry(TextDiffOperation operation, string? oldText, string? newText, int? moveId)
Parameters
operation TextDiffOperation
What happened to the chunk.
oldText string?
The chunk in the old text, or null for an insertion.
newText string?
The chunk in the new text, or null for a deletion.
moveId int?
The identifier shared by the entries of a moved block, or null.

Properties

NameDescription
MoveIdGets the identifier of the moved block this entry belongs to, or null when the chunk is not part of a move.
NewTextGets the chunk as it appears in the new text, or null when TextDiffEntry.Operation is TextDiffOperation.Delete.
OldTextGets the chunk as it appears in the old text, or null when TextDiffEntry.Operation is TextDiffOperation.Insert.
Operation
TextGets TextDiffEntry.OldText, or TextDiffEntry.NewText when TextDiffEntry.Operation is TextDiffOperation.Insert.

Gets the identifier of the moved block this entry belongs to, or null when the chunk is not part of a move.

public int? MoveId { get; }

Property value

int?

Remarks

Moves are only detected when TextDiffOptions.DetectMoves is set. The TextDiffOperation.Delete entries where the block was and the TextDiffOperation.Insert entries where it is now share the same identifier. Identifiers start at 0 and follow the order of the deleted blocks.

Gets the chunk as it appears in the new text, or null when TextDiffEntry.Operation is TextDiffOperation.Delete.

public string? NewText { get; }

Property value

string?

Remarks

When an option such as TextDiffOptions.IgnoreCase or TextDiffOptions.IgnoreWhitespace makes two different chunks compare equal, an TextDiffOperation.Equal entry keeps both sides: TextDiffEntry.OldText and TextDiffEntry.NewText then differ. Append TextDiffEntry.NewText for TextDiffOperation.Equal and TextDiffOperation.Insert entries to rebuild the new text.

Gets the chunk as it appears in the old text, or null when TextDiffEntry.Operation is TextDiffOperation.Insert.

public string? OldText { get; }

Property value

string?

public TextDiffOperation Operation { get; }

Property value

TextDiffOperation

No documentation is available.

public string Text { get; }

Property value

string

Remarks

For an TextDiffOperation.Equal entry this is the chunk from the old text, which is not necessarily the chunk from the new text. Use TextDiffEntry.OldText and TextDiffEntry.NewText to rebuild either side of the diff.

Methods

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

Equals overloads

Equals(TextDiffEntry)

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

bool

No documentation is available.

Equals(object?)

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

bool

No documentation is available.

GetHashCode()

TextDiffEntry.cs
public override int GetHashCode()

Returns

int

No documentation is available.

public override string ToString()

Returns

string

No documentation is available.

Operators

NameDescription
operator ==(TextDiffEntry, TextDiffEntry)
operator !=(TextDiffEntry, TextDiffEntry)

operator ==(TextDiffEntry, TextDiffEntry)

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

Parameters

left TextDiffEntry
right TextDiffEntry

Returns

bool

No documentation is available.

operator !=(TextDiffEntry, TextDiffEntry)

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

Parameters

left TextDiffEntry
right TextDiffEntry

Returns

bool

No documentation is available.