NotT Class

Applies logical NOT to the specified condition.
Inheritance Hierarchy

Namespace:  Aspose.Tasks.Util
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 20.10
public class Not<T> : ICondition<T>

Type Parameters

The type of object to apply method interface to.

The NotT type exposes the following members.

Public methodCode exampleNotT
Initializes a new instance of the NotT class.
Public methodCode exampleCheck
Returns true if the specified object satisfy the condition.
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodToString (Inherited from Object.)
Shows how to use <see cref="Aspose.Tasks.Util.Not`1" /> condition.
public void WorkWithNot()
    var project = new Project(DataDir + "Project2.mpp");

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

    // create a filter condition
    var filter = new NullCondition();

    // and reverse it by applying <see cref="Aspose.Tasks.Util.Not`1" /> condition
    var condition = new Not<Task>(filter);

    // apply the condition to the collected tasks
    List<Task> collection = Filter(coll.Tasks, condition);
    foreach (var task in collection)
        Console.WriteLine("Name: " + task.Get(Tsk.Name));

        // work with other properties...

    // ...

private static List<T> Filter<T>(IEnumerable<T> array, ICondition<T> cond)
    var result = new List<T>();

    foreach (var item in array)
        if (cond.Check(item))

    return result;

private class NullCondition : ICondition<Task>
    public bool Check(Task el)
        return el.Get(Tsk.IsNull).Value;
See Also