IAlgorithmT Interface

Represents an algorithm that can be applied to a list of objects T.

Namespace:  Aspose.Tasks.Util
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 20.10
public interface IAlgorithm<in T>

Type Parameters

The type of object to apply method interface to.

The IAlgorithmT type exposes the following members.

Public methodCode exampleAlg
Processes an object in the list. Called after PreAlg(T, Int32);
Public methodCode examplePostAlg
Called after processing of an object.
Public methodCode examplePreAlg
Called before processing of an object.
Shows how to work with list util Apply method.
public void WorkWithListUtilsApply()
    var project = new Project(DataDir + "Project2003.mpp");
    List<Filter> filters = project.TaskFilters.ToList();

    Assert.AreEqual(3, filters.Count, "Project.TaskFilters count");

    ListUtils.Apply(filters, new RenameAlgorithm(), 0);

    foreach (var filter in filters)
        Console.WriteLine("Name: " + filter.Name);
        Console.WriteLine("Filter Type: " + filter.FilterType);
        Console.WriteLine("Show In Menu: " + filter.ShowInMenu);
        Console.WriteLine("Show Related Summary Rows: " + filter.ShowRelatedSummaryRows);

private class RenameAlgorithm : IAlgorithm<Filter>
    private int current;

    public RenameAlgorithm()
        this.current = 0;

    public void PreAlg(Filter el, int index)

    public void Alg(Filter el, int index)
        el.Name = el.Name + " " + this.current;

    public void PostAlg(Filter el, int index)
See Also