TX Text Control .NET for Windows Forms

Remove Method

Method|Introduced in 26.0
Namespace
TXTextControl
Package
TXTextControl.TextControl.WinForms.SDK as TXTextControl.dll from the private NuGet feed or Text Control Offline Packages

Description

Removes a tracked change from the collection. Depending on the accept parameter the change is either accepted or rejected. When a change is rejected, inserted text is removed and deleted text is reinserted.

Syntax

public bool Remove(TrackedChange trackedChange, bool accept);

Parameters

ParameterDescription
trackedChange

Specifies the tracked change to remove.

accept

When this parameter is true, the change is accepted, otherwise, it is rejected.

Return Value

The return value is true, if the change could be removed. Otherwise, it is false.

Examples

The following example accepts all revisions authored by the review team while safely avoiding mutation during enumeration.

TrackedChange[] approvedChanges = textControl.TrackedChanges
    .Cast<TrackedChange>()
    .Where(change => change.UserName == "Review Team")
    .ToArray();

foreach (TrackedChange change in approvedChanges)
{
    textControl.TrackedChanges.Remove(change, true);
}

Further Reading

  • Powerful Extension Methods to Handle Tracked Changes –