public static HashSet <TSource> ToHashSet <TSource>(this List <TSource> source, IEqualityComparer <TSource> comparer = null) { var aggregate = new ToHashSet <TSource>(comparer); ListSegmentNode.ProcessList(source, ref aggregate); return(aggregate.GetResult()); }
public static HashSet <TSource> ToHashSet <TSource>(this ReadOnlyMemory <TSource> source, IEqualityComparer <TSource> comparer = null) { var aggregate = new ToHashSet <TSource>(comparer); MemoryNode.ProcessMemory(source, ref aggregate); return(aggregate.GetResult()); }
public static HashSet <TSource> ToHashSet <TSource>(this TSource[] source, IEqualityComparer <TSource> comparer = null) { var aggregate = new ToHashSet <TSource>(comparer); ArrayNode.ProcessArray(source, ref aggregate); return(aggregate.GetResult()); }