Apply

TaskUtils.Apply method

Applies specified algorithm to each task of a tree.

public static void Apply(Task root, ITreeAlgorithm<Task> alg, int level)
ParameterTypeDescription
rootTaskRoot of the tree
algITreeAlgorithm`1Applied algorithm.
levelInt32Level of the root task.

Examples

Shows how to work with a tree algorithm.

var project = new Project(DataDir + "Project2.mpp");

// gather all project tasks
var coll = new ChildTasksCollector();
TaskUtils.Apply(project.RootTask, coll, 0);

// work with tasks as with a plain list
foreach (var task in coll.Tasks)
{
    Console.WriteLine("Task Name: " + task.Get(Tsk.Name));
}

See Also