TextDiffEntry Struct
public readonly struct TextDiffEntry : IEquatable<TextDiffEntry>No documentation is available.
- Implements
Constructors
| Name | Description |
|---|---|
| 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.cspublic TextDiffEntry(TextDiffOperation operation, string text)Parameters
operationTextDiffOperationtextstring
No documentation is available.
TextDiffEntry(TextDiffOperation, string?, string?)
TextDiffEntry.cspublic TextDiffEntry(TextDiffOperation operation, string? oldText, string? newText)Parameters
operationTextDiffOperationoldTextstring?newTextstring?
No documentation is available.
TextDiffEntry(TextDiffOperation, string?, string?, int?)
TextDiffEntry.csInitializes a new entry that belongs to a moved block.
public TextDiffEntry(TextDiffOperation operation, string? oldText, string? newText, int? moveId)Parameters
operationTextDiffOperation- What happened to the chunk.
oldTextstring?- The chunk in the old text, or
nullfor an insertion. newTextstring?- The chunk in the new text, or
nullfor a deletion. moveIdint?- The identifier shared by the entries of a moved block, or
null.
Properties
| Name | Description |
|---|---|
| MoveId | Gets the identifier of the moved block this entry belongs to, or null when the chunk is not part of a move. |
| NewText | Gets the chunk as it appears in the new text, or null when TextDiffEntry.Operation is TextDiffOperation.Delete. |
| OldText | Gets the chunk as it appears in the old text, or null when TextDiffEntry.Operation is TextDiffOperation.Insert. |
| Operation | |
| Text | Gets TextDiffEntry.OldText, or TextDiffEntry.NewText when TextDiffEntry.Operation is TextDiffOperation.Insert. |
MoveId
TextDiffEntry.csGets 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
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.
NewText
TextDiffEntry.csGets the chunk as it appears in the new text, or null when TextDiffEntry.Operation is TextDiffOperation.Delete.
public string? NewText { get; }Property value
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.
OldText
TextDiffEntry.csGets the chunk as it appears in the old text, or null when TextDiffEntry.Operation is TextDiffOperation.Insert.
public string? OldText { get; }Property value
Operation
TextDiffEntry.csText
TextDiffEntry.csGets TextDiffEntry.OldText, or TextDiffEntry.NewText when TextDiffEntry.Operation is TextDiffOperation.Insert.
public string Text { get; }Property value
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
| Name | Description |
|---|---|
| Equals(TextDiffEntry) | |
| Equals(object?) | |
| GetHashCode() | |
| ToString() |
Equals overloads
Equals(TextDiffEntry)
TextDiffEntry.cspublic bool Equals(TextDiffEntry other)No documentation is available.
Equals(object?)
TextDiffEntry.csGetHashCode()
TextDiffEntry.csToString()
TextDiffEntry.csOperators
| Name | Description |
|---|---|
| operator ==(TextDiffEntry, TextDiffEntry) | |
| operator !=(TextDiffEntry, TextDiffEntry) |
operator ==(TextDiffEntry, TextDiffEntry)
TextDiffEntry.cspublic static bool operator ==(TextDiffEntry left, TextDiffEntry right)No documentation is available.
operator !=(TextDiffEntry, TextDiffEntry)
TextDiffEntry.cspublic static bool operator !=(TextDiffEntry left, TextDiffEntry right)No documentation is available.