TaskUtilsApply Method

Applies specified algorithm to each task of a tree.

Namespace:  Aspose.Tasks.Util
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 20.11
Syntax
public static void Apply(
	Task root,
	ITreeAlgorithm<Task> alg,
	int level
)

Parameters

root
Type: Aspose.TasksTask
Root of the tree
alg
Type: Aspose.Tasks.UtilITreeAlgorithmTask
Applied algorithm.
level
Type: SystemInt32
Level 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