2 using System.Collections.Generic;
7 public static class ReadOnlyListExtensions
9 public static int IndexOf<T>(
this IReadOnlyList<T> list, T elem)
10 => list.IndexOf(input => input.Equals(elem));
12 public static int IndexOf<T>(
this IReadOnlyList<T> list, Func<T, bool> predicate)
14 for (
int i = 0; i < list.Count; i++)
16 if (predicate(list[i])) {
return i; }
21 public static T Find<T>(
this IReadOnlyList<T> list, Func<T, bool> predicate)
23 return list.FirstOrDefault(predicate);