AnalyzeOptions#
Options for Project.Analyze. They select the analytics that fill ScheduleResult.Analytics. new AnalyzeOptions() requests no analytics.
Declaration#
public sealed class AnalyzeOptions : IDeepCloneable<AnalyzeOptions>
{
public AnalyticsOptions Analytics { get; set; } = new();
public AnalyzeOptions DeepClone();
}
Set the property with an object initializer: new AnalyzeOptions { Analytics = new AnalyticsOptions { Slack = true } }.
Properties#
| Property | Type | Default | Description |
|---|---|---|---|
Analytics |
AnalyticsOptions |
new() (no analytics) |
Requests critical path and slack. Fills ScheduleResult.Analytics. |
Analytics#
public AnalyticsOptions Analytics { get; set; } = new();
Turns on AnalyticsOptions.Slack and AnalyticsOptions.CriticalPath. With both flags false (the default), ScheduleResult.Analytics is null. With either flag set, it holds an Analytics value; check its Status before reading the data.
Methods#
DeepClone#
public AnalyzeOptions DeepClone()
Returns a copy that shares no nested object (Analytics) with this one.
Example#
using Plen;
var monday = Moment.FromYmdHm(2026, 1, 5, 8, 0) ?? throw new InvalidOperationException("invalid date");
var data = new ProjectData
{
Tasks =
[
new TaskData("design") { StartDate = monday, Duration = 2.0 },
new TaskData("build") { StartDate = monday, Duration = 3.0 },
],
Links = [new LinkData { Id = "l1", Source = "design", Target = "build" }],
};
var options = new AnalyzeOptions
{
Analytics = new AnalyticsOptions { CriticalPath = true, Slack = true },
};
var project = new Project();
var result = project.Analyze(data, options);
if (result.Analytics is { Status: AnalyticsStatus.Available, Slack: { } slack })
{
foreach (var s in slack)
Console.WriteLine($"{s.Task}: total {s.Total}, free {s.Free}");
}
Related#
Project.Analyze- the call these options configureAnalyticsOptions- the analytics flagsAnalytics- the analytics returned in the result- Critical path and slack - analyzing without scheduling