TaskData#
One task in ProjectData.Tasks or in a SchedulingChanges.Tasks.Add list. Create it with new TaskData(id) and set the other properties in an object initializer. To change a task that a project already holds, send a TaskUpdate instead.
Declaration#
public sealed class TaskData : IDeepCloneable<TaskData>
A leaf task needs two of StartDate, EndDate and Duration. A summary takes both dates or neither, and a milestone takes one date. Project data explains these date rules, and Validation rules lists the input that strict validation rejects.
Constructors#
TaskData(Id)#
public TaskData(Id id)
Creates an auto-scheduled task of type Task with priority 500, no dates and every other property at its default.
| Name | Type | Description |
|---|---|---|
id |
Id |
Task id. A string, int or double converts implicitly. |
Properties#
| Property | Type | Default | Description |
|---|---|---|---|
Id |
Id |
required | Task id. Unique among the project's tasks. |
Parent |
Id? |
null |
Id of the parent summary. null, "" and a value equal to SchedulingConfig.RootId all mean a root task. |
TaskType |
TaskType |
TaskType.Task |
Leaf task, summary or milestone. Wire name type. |
StartDate |
Moment? |
null |
Start date. |
EndDate |
Moment? |
null |
End date. |
Duration |
double? |
null |
Working time in DurationUnit. |
DurationUnit |
TimeUnit? |
null |
Unit of Duration, LevelingDelay and Pauses. null uses SchedulingConfig.DurationUnit. |
ConstraintType |
ConstraintType? |
null |
Scheduling constraint. null means no constraint. Constraints act only when SchedulingConfig.ApplyConstraints is on. |
ConstraintDate |
Moment? |
null |
Date of a dated constraint. Required when ConstraintType is a dated constraint. |
AutoScheduling |
bool |
true |
false makes the task fixed: the planner never moves it. |
Unscheduled |
bool |
false |
true keeps the task in the data but out of the plan. An unscheduled task needs no dates and isn't reported. |
Progress |
double |
0.0 |
Completed fraction, from 0 to 1. With SchedulingConfig.UseProgress on, 1 marks the task as completed. |
Priority |
ushort |
500 |
Leveling priority, 0 to 1000. 1000 means the task is never leveled. |
LevelingDelay |
double |
0.0 |
Delay added by leveling, as elapsed (wall-clock) time in the task's duration unit. Rounded to whole minutes on use. |
Pauses |
List<Pause> |
empty | Leveling splits in the task's work, sorted by At and non-overlapping. Empty means uninterrupted work. Ignored on summaries, milestones and unscheduled tasks. |
CalendarId |
Id? |
null |
The task's own calendar. null uses the global calendar, or the parent's calendar in CalendarMode.TaskInherited. |
LevelingDelay and Pauses normally come from Project.Level. Setting Pauses to an empty list and LevelingDelay to 0 clears a task's leveling. See Leveling resources.
Methods#
DeepClone#
public TaskData DeepClone()
Returns a copy that shares no list or nested record with this task, including Pauses.
Returns: a new TaskData with the same values.
ToString#
public override string ToString()
Returns a debug dump of the fields, e.g. TaskData { Id: a, Parent: null, TaskType: Task, … }.
TaskType#
The kind of a task, set in TaskData.TaskType.
public enum TaskType { Task, Summary, Milestone }
| Value | Description |
|---|---|
Task |
A leaf task. The default. |
Summary |
A summary task whose span covers its children. The wire value "project" also reads as Summary. |
Milestone |
A zero-duration milestone. |
ConstraintType#
A task's scheduling constraint, set in TaskData.ConstraintType. All values except Asap and Alap are dated and need ConstraintDate.
public enum ConstraintType { Asap, Alap, Snet, Snlt, Fnet, Fnlt, Mso, Mfo }
| Value | Description |
|---|---|
Asap |
As soon as possible. |
Alap |
As late as possible. |
Snet |
Start no earlier than ConstraintDate. |
Snlt |
Start no later than ConstraintDate. |
Fnet |
Finish no earlier than ConstraintDate. |
Fnlt |
Finish no later than ConstraintDate. |
Mso |
Must start on ConstraintDate. |
Mfo |
Must finish on ConstraintDate. |
The enum has no parsing or spelling helpers. JSON spellings (the lowercase names) are handled by the Plen.Wire package. See Links, constraints and summaries for how the planner applies each constraint.
Example#
using Plen;
var monday = Moment.FromYmdHm(2026, 3, 2, 8, 0) ?? throw new InvalidOperationException("invalid date");
var data = new ProjectData
{
Config = new SchedulingConfig { ApplyConstraints = true },
Tasks =
[
new TaskData("phase") { TaskType = TaskType.Summary },
new TaskData("design") { Parent = "phase", StartDate = monday, Duration = 3 },
new TaskData("review")
{
Parent = "phase",
StartDate = monday,
Duration = 4,
DurationUnit = TimeUnit.Hour,
ConstraintType = ConstraintType.Snet,
ConstraintDate = Moment.FromYmdHm(2026, 3, 9, 8, 0),
},
new TaskData("release") { TaskType = TaskType.Milestone, StartDate = monday, AutoScheduling = false },
],
};
var result = Engine.Schedule(data, new SolveOptions());
Related#
ProjectData- the snapshot that holds tasksTaskUpdate- edits an existing taskSchedulingConfig- project-wide defaults for tasks- Project data - date rules and validation
- Links, constraints and summaries - constraints and summary tasks