Tab
A newer version of this page is available. Switch to the current version.

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.v18.2.dll

Declaration

public T Find(
    Predicate<T> match
)
Public Function Find(
    match As Predicate(Of T)
) As T

Parameters

Name Type Description
match Predicate<T>

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

Returns

Type Description
T

The element that matches the conditions defined by the predicate.

Remarks

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.

Examples

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