Table of Contents

Class ExEnumerable

Namespace
System.Linq
Assembly
ExControls.dll

Extension methods for IEnumerable<T> missing in the BCL. Kept in the System.Linq namespace so existing calls keep compiling, but under its own name - a second System.Linq.Enumerable made Enumerable.Range and similar calls ambiguous (CS0433).

public static class ExEnumerable
Inheritance
ExEnumerable
Inherited Members

Methods

FindIndex<TSource>(IEnumerable<TSource>, Func<TSource, bool>)

Finds the index of the first item matching an expression in an enumerable.

public static int FindIndex<TSource>(this IEnumerable<TSource> items, Func<TSource, bool> predicate)

Parameters

items IEnumerable<TSource>

The enumerable to search.

predicate Func<TSource, bool>

The expression to test the items against.

Returns

int

The index of the first matching item, or -1 if no items match.

Type Parameters

TSource

IndexOf<TSource>(IEnumerable<TSource>, TSource)

Finds the index of the first occurrence of an item in an enumerable.

public static int IndexOf<TSource>(this IEnumerable<TSource> items, TSource item)

Parameters

items IEnumerable<TSource>

The enumerable to search.

item TSource

The item to find.

Returns

int

The index of the first matching item, or -1 if the item was not found.

Type Parameters

TSource