IndexOf
///
/// Returns the index of the first element in this
/// satisfying the specified . If no such elements
/// are found, returns -1.
///
public static int IndexOf(this IEnumerable source, Func condition)
{
if (source == null)
throw new ArgumentNullException("source");
if (condition == null)
throw new ArgumentNullException("condition");
int index = 0;
foreach (var v in source)
{
if (condition(v))
return index;
index++;
}
return -1;
}