mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +00:00
chore: Added comparer to ToIcdHashset extention
This commit is contained in:
parent
8871fad40a
commit
254ed85d83
1 changed files with 18 additions and 0 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue