4 using System.Collections;
5 using System.Collections.Generic;
8 namespace SiliconStudio.Core.Extensions
22 IEnumerator enumerator = source.GetEnumerator();
23 if (enumerator == null)
24 throw new ArgumentException(
"Invalid 'source' IEnumerable.");
26 return enumerator.MoveNext() ==
false;
36 public static void ForEach<T>(
this IEnumerable source, Action<T> action)
38 source.Cast<T>().ForEach(action);
50 foreach (T item
in source)
61 public static int IndexOf<T>(
this IEnumerable<T> source, Func<T, bool> predicate)
64 foreach (T item
in source)
80 public static int LastIndexOf<T>(
this IEnumerable<T> source, Func<T, bool> predicate)
86 for (
int i = list.Count - 1; i >= 0; --i)
88 if (predicate(list[i]))
95 foreach (T item
in source)
112 var node = list.First;
static bool IsNullOrEmpty(this IEnumerable source)
Tells whether a sequence is null or empty.