Extensions to IEnumerable

List of methods

Here is a summary of the algorithms and usage. Please see the tests in the source code for more detailed examples and explanation.

  • Cast: collection.Cast<T> (casts a non generic collection to a generic one)
  • Count: collection.Count (returns the size of the collection)
  • Collect: collection.Collect( x => x.Name ) (gets all the names in the collection)
  • Copy: collection.Copy( target, x => x >5 ) (copies to target all the elements that match the predicate)
  • Find: collection.Find( x => x > 5 ) (finds the element that matches the predicate)
  • FindAll: collection.FindAll( x => x > 5 ) (finds all the elements that match the predicate)
  • ForEach: collection.ForEach( x => Console.Out.WriteLine( x ) ) (applies the action for each element in the collection)
  • IndexOf: collection.IndexOf( x => x > 5 ) (finds the index of the element that matches the predicate)
  • Join: collection.Join( ‘|’ ) (joins the elements of the collection as string using the separator)
  • ToArrary: collection.ToArray (creates an array with the elements in the collection)