[Canonical page](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/changes/>)
[Full documentation index](<https://docs.dhtmlx.com/planning-engine/llms.txt>)


# Changes<TAdd, TUpdate>

The edits to one record kind: records to add, partial updates, and ids to remove. Every [`SchedulingChanges`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/scheduling-changes.md>) starts with an empty instance for each record kind. Edits go into its lists.

| Property of `SchedulingChanges` | Type |
|---|---|
| `Tasks` | `Changes<TaskData, TaskUpdate>` |
| `Links` | `Changes<LinkAdd, LinkUpdate>` |
| `Resources` | `Changes<ResourceData, ResourceUpdate>` |
| `Assignments` | `Changes<AssignmentData, AssignmentUpdate>` |

## Declaration

```csharp
namespace Plen;

public sealed class Changes<TAdd, TUpdate> : IDeepCloneable<Changes<TAdd, TUpdate>>
    where TAdd : IDeepCloneable<TAdd>
    where TUpdate : IDeepCloneable<TUpdate>
```

| Type parameter | Description |
|---|---|
| `TAdd` | The full record to add: [`TaskData`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/task-data.md>), [`LinkAdd`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/link-add.md>), [`ResourceData`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/resource-data.md>) or [`AssignmentData`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/assignment-data.md>). |
| `TUpdate` | The partial update record: [`TaskUpdate`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/task-update.md>), [`LinkUpdate`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/link-update.md>), [`ResourceUpdate`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/resource-update.md>) or [`AssignmentUpdate`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/assignment-update.md>). |

Both type arguments implement [`IDeepCloneable<T>`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/i-deep-cloneable.md>), so `DeepClone()` can copy every record in the lists.

## Constructors

### Changes()

```csharp
public Changes()
```

Creates an instance with all three lists empty.

## Properties

| Property | Type | Default | Description |
|---|---|---|---|
| `Add` | `List<TAdd>` | empty | Records to add. The id of each record must not exist yet. A [`LinkAdd`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/link-add.md>) or [`AssignmentData`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/assignment-data.md>) without an id gets a generated one. |
| `Update` | `List<TUpdate>` | empty | Partial updates. Each record names an existing id. Its [`Patch<T>`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/patch.md>) fields keep, clear or set each value. |
| `Remove` | `List<Id>` | empty | Ids of existing records to remove. |

```csharp
public List<TAdd> Add { get; set; }
public List<TUpdate> Update { get; set; }
public List<Id> Remove { get; set; }
```

Each entry is one operation. In [`ApplyReport`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/apply-report.md>), an operation's path is its group, its list and its index: `tasks.add[0]`, `links.remove[1]`, `assignments.update[2]`. An unknown id in `Update` or `Remove`, or an id in `Add` that already exists, rejects that operation. Removing a record also removes the records that depend on it, and the report's `Effects` lists them. For the order in which the lists run, see [`SchedulingChanges`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/scheduling-changes.md>).

## Methods

### DeepClone

```csharp
public Changes<TAdd, TUpdate> DeepClone()
```

Returns a copy with new lists. Each record in `Add` and `Update` is deep-copied. `Remove` holds the same [`Id`](<https://docs.dhtmlx.com/planning-engine/net/api/core/data/id.md>) values, which are immutable.

### ToString

```csharp
public override string ToString()
```

Returns a readable rendering of `Add`, `Update` and `Remove`, for logging.

## Example

Add, update and remove tasks in one change set:

```csharp
using Plen;

var monday = Moment.FromYmdHm(2026, 8, 10, 8, 0) ?? throw new InvalidOperationException("invalid date");
var data = new ProjectData
{
    Tasks =
    [
        new TaskData(1) { StartDate = monday, Duration = 2.0 },
        new TaskData(2) { StartDate = monday, Duration = 1.0 },
    ],
};

var project = new Project();
var solved = project.Solve(data, new SolveOptions());

var changes = new SchedulingChanges { BaselineId = solved.BaselineId };
changes.Tasks.Add.Add(new TaskData(3) { StartDate = monday, Duration = 4.0 });
changes.Tasks.Update.Add(new TaskUpdate(1) { Duration = 3.0 });
changes.Tasks.Remove.Add(2);

var report = project.Apply(changes);
foreach (var applied in report.Applied)
{
    Console.WriteLine(applied.Path); // tasks.remove[0], tasks.add[0], tasks.update[0]
}
```

## Related

- [`SchedulingChanges`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/scheduling-changes.md>) - the change set that holds one instance per record kind
- [`Patch<T>`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/patch.md>) - the field type of update records
- [`ApplyReport`](<https://docs.dhtmlx.com/planning-engine/net/api/core/changes/apply-report.md>) - per-operation outcome
- [`Project.Apply`](<https://docs.dhtmlx.com/planning-engine/net/api/project-apply.md>) - commits the change set
- [Editing a project](<https://docs.dhtmlx.com/planning-engine/net/live-projects/editing-a-project.md>) - adding, updating and removing records
