chore: Added comparer to ToIcdHashset extention

This commit is contained in:
Rashod Davis
2018-08-29 13:07:31 -04:00
parent 8871fad40a
commit 254ed85d83

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>