Skip to main content
Tab

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

Returns the zero-based index of the first element that matches the conditions defined by the specified predicate.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

public int IndexOf(
    Predicate<T> match
)

Parameters

Name Type Description
match Predicate<T>

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

Returns

Type Description
Int32

The zero-based index of the first element that matches the conditions defined by the predicate.

Remarks

The IndexOf method individually passes elements of the current collection to a predicate, and returns the zero-based index of 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.

Example

using DevExpress.Web.ASPxNavBar;
...
int ExpandedGroupIndex = ASPxNavBar1.Groups.IndexOf(IsExpanded);
...
private static bool IsExpanded(NavBarGroup group) {
     return group.Expanded;
}
See Also