3 public static T
ElementAt<T, E>(E enumerator,
int index) where E : IEnumerator<T> {
6 if (!enumerator.MoveNext()) {
7 throw new IndexOutOfRangeException(
"ElementAt() index out of range.");
12 return enumerator.Current;
16 for (
int num = list.Count - 1; num > 0; num--) {
17 int index = random(num + 1);
18 T value = list[index];
19 list[index] = list[num];
24 public static int FirstIndex<T>(
this IEnumerable<T> collection, T value) {
26 foreach (T item
in collection) {
27 if (Equals(item, value)) {
35 public static int FirstIndex<T>(
this IEnumerable<T> collection, Func<T, bool> predicate) {
37 foreach (T item
in collection) {
38 if (predicate(item)) {
46 public static T
SelectNth<T>(
this IList<T> list,
int n, IComparer<T> comparer) {
49 throw new ArgumentException();
52 int num2 = list.Count - 1;
56 T y = list[(num3 + num4) / 2];
58 if (comparer.Compare(list[num3], y) >= 0) {
60 list[num4] = list[num3];
68 if (comparer.Compare(list[num3], y) > 0) {
static void RandomShuffle< T >(this IList< T > list, Func< int, int > random)
static T ElementAt< T, E >(E enumerator, int index)
static int FirstIndex< T >(this IEnumerable< T > collection, T value)
static T SelectNth< T >(this IList< T > list, int n, IComparer< T > comparer)