CSharp examples for System.Collections.Generic:IEnumerable
Minus one IEnumerable from IEnumerable
using System;//from w w w.j a v a 2 s . com using System.Linq; using System.Collections.Generic; public class Main{ public static IEnumerable<T> Minus<T> (this IEnumerable<T> source, IEnumerable<T> what, Comparer<T> comparer, Cloner<T> cloner) { var v = what.ToList (); foreach (var t in source) if (v.All (i => !comparer (t, i))) yield return cloner (t); } public static IEnumerable<T> Minus<T> (this IEnumerable<T> source, IEnumerable<T> what, Comparer<T> comparer) { var v = what.ToList (); foreach (var t in source) if (v.All (i => !comparer (t, i))) yield return t; } }