Merge branch 'IcdHashsetExt' of Common/Utils into dev

This commit is contained in:
Chris Cameron
2018-08-29 17:38:02 +00:00
committed by Gogs

View File

@@ -710,6 +710,24 @@ namespace ICD.Common.Utils.Extensions
return new IcdHashSet<T>(extends);
}
/// <summary>
/// Returns the sequence as a IcdHashSet.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="extends"></param>
/// <param name="comparer"></param>
/// <returns></returns>
public static IcdHashSet<T> ToIcdHashSet<T>(this IEnumerable<T> extends, IEqualityComparer<T> comparer)
{
if (extends == null)
throw new ArgumentNullException("extends");
if (comparer == null)
throw new ArgumentNullException("comparer");
return new IcdHashSet<T>(comparer, extends);
}
/// <summary>
/// Optimized ToArray implementation with fewer allocations.
/// </summary>