public static IEnumerable <T> TopoSort <T, TKey>(
     this ICollection <T> source,
     [InstantHandle] Func <T, IEnumerable <T> > dependsOnGetter,
     [InstantHandle] Func <T?, TKey> keySelector)
     where T : notnull
     where TKey : notnull =>
 TopoSort(source, dependsOnGetter, KeyEqualityComparer.Create(keySelector));
 public static IEnumerable <T> TopoSort <T, TKey>(
     [InstantHandle] this IEnumerable <T> source,
     [InstantHandle] Func <T, IEnumerable <T> > dependsOnGetter,
     [InstantHandle] Func <T?, TKey> keySelector)
     where T : notnull
     where TKey : notnull
 {
     Code.NotNull(source, nameof(source));
     return(TopoSort(source, dependsOnGetter, KeyEqualityComparer.Create(keySelector)));
 }
Ejemplo n.º 3
0
 public static IEnumerable <TSource> UnionBy <TSource, TKey>(
     [NotNull] this IEnumerable <TSource> first,
     [NotNull] IEnumerable <TSource> second,
     [NotNull] Func <TSource, TKey> keySelector,
     IEqualityComparer <TKey> comparer) =>
 first.Union(second, KeyEqualityComparer.Create(keySelector, comparer));
Ejemplo n.º 4
0
 public static IEnumerable <TSource> IntersectBy <TSource, TKey>(
     [NotNull] this IEnumerable <TSource> first,
     [NotNull] IEnumerable <TSource> second,
     [NotNull] Func <TSource, TKey> keySelector) =>
 first.Intersect(second, KeyEqualityComparer.Create(keySelector));
Ejemplo n.º 5
0
 public static IEnumerable <TSource> DistinctBy <TSource, TKey>(
     [NotNull] this IEnumerable <TSource> source,
     [NotNull] Func <TSource, TKey> keySelector,
     IEqualityComparer <TKey> comparer) =>
 source.Distinct(KeyEqualityComparer.Create(keySelector, comparer));
Ejemplo n.º 6
0
 public static IEnumerable <T> TopoSort <T, TKey>(
     [NotNull] this ICollection <T> source,
     [NotNull, InstantHandle] Func <T, IEnumerable <T> > dependsOnGetter,
     [NotNull, InstantHandle] Func <T, TKey> keySelector,
     [NotNull] IEqualityComparer <TKey> keyComparer) =>
 TopoSort(source, dependsOnGetter, KeyEqualityComparer.Create(keySelector, keyComparer));