wasSharp – Diff between revs 53 and 54
?pathlinks?
Rev 53 | Rev 54 | |||
---|---|---|---|---|
Line 22... | Line 22... | |||
22 | /// <returns>the first sequence excluding the second sequence or the second sequence excluding the first sequence</returns> |
22 | /// <returns>the first sequence excluding the second sequence or the second sequence excluding the first sequence</returns> |
|
23 | public static IEnumerable<T> SequenceExceptAny<T>(this IEnumerable<T> o, IEnumerable<T> p) where T : IEquatable<T> |
23 | public static IEnumerable<T> SequenceExceptAny<T>(this IEnumerable<T> o, IEnumerable<T> p) where T : IEquatable<T> |
|
24 | { |
24 | { |
|
25 | var l = new List<T>(o); |
25 | var l = new List<T>(o); |
|
26 | var r = new List<T>(p); |
26 | var r = new List<T>(p); |
|
27 | return l.Count > r.Count |
27 | return l.Count() > r.Count() |
|
28 | ? l.Zip(r, (x, y) => x.Equals(y) ? default(T) : y) |
28 | ? l.Zip(r, (x, y) => x.Equals(y) ? default(T) : y) |
|
29 | .Concat(l.Skip(r.Count)) |
29 | .Concat(l.Skip(r.Count())) |
|
30 | .Where(q => q != null && !q.Equals(default(T))) |
30 | .Where(q => q != null && !q.Equals(default(T))) |
|
31 | : r.Zip(l, (x, y) => x.Equals(y) ? default(T) : y) |
31 | : r.Zip(l, (x, y) => x.Equals(y) ? default(T) : y) |
|
32 | .Concat(r.Skip(l.Count)) |
32 | .Concat(r.Skip(l.Count())) |
|
33 | .Where(q => q != null && !q.Equals(default(T))); |
33 | .Where(q => q != null && !q.Equals(default(T))); |
|
34 | } |
34 | } |
|
Line 35... | Line 35... | |||
35 | |
35 | |
|
36 | /// <summary> |
36 | /// <summary> |