ListUtilsFindT Method

Find first occurrence of an list element which satisfy specified condition.

Namespace:  Aspose.Tasks.Util
Assembly:  Aspose.Tasks (in Aspose.Tasks.dll) Version: 20.11
public static T Find<T>(
	IList<T> list,
	ICondition<T> cond


Type: System.Collections.GenericIListT
A list to process.
Type: Aspose.Tasks.UtilIConditionT
Condition used to find an element in the specified list.

Type Parameters

The type of object to find.

Return Value

Type: T
List element or null.
Shows how to work with list util Find method.
public void WorkWithListUtilsFind()
    var project = new Project(DataDir + "Project2003.mpp");
    List<Filter> taskFilters = project.TaskFilters.ToList();

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

    var filter = ListUtils.Find(taskFilters, new FilterByName("&All Tasks"));

    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);

public class FilterByName : ICondition<Filter>
    private readonly string name;

    public FilterByName(string name)
    { = name;

    /// <summary>
    /// Returns true if the specified object satisfy the conditions.
    /// </summary>
    /// <param name="el">The object to check.</param>
    /// <returns>True if the object satisfy the conditions.</returns>
    /// <inheritdoc />
    public bool Check(Filter el)
        return el.Name ==;
See Also