Skip to main content

Collection<T>.Find(Predicate<T>) Method

Returns the first element that matches the conditions defined by the specified predicate.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v23.1.dll

NuGet Package: DevExpress.Web


public T Find(
    Predicate<T> match


Name Type Description
match Predicate<T>

A delegate that defines the conditions of the elements to search for.


Type Description

The element that matches the conditions defined by the predicate.


The Find method individually passes elements of the current collection to a predicate, and returns the first element that matches the predicate. A predicate is a delegate to a method that returns true if the object passed to it matches the conditions defined in the delegate; otherwise the method returns false.


The code sample below demonstrates how to obtain a navigation bar group that is currently expanded. For this purpose, the Find method is used. The IsExpanded predicate determines whether a group is expanded.

using DevExpress.Web.ASPxNavBar;
NavBarGroup ExpandedGroup = ASPxNavBar1.Groups.Find(IsExpanded);
private static bool IsExpanded(NavBarGroup group) {
     return group.Expanded;
See Also