From 254ed85d83d6872c1f57cc453b686a8cc64e2c3d Mon Sep 17 00:00:00 2001 From: Rashod Davis Date: Wed, 29 Aug 2018 13:07:31 -0400 Subject: [PATCH] chore: Added comparer to ToIcdHashset extention --- .../Extensions/EnumerableExtensions.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/ICD.Common.Utils/Extensions/EnumerableExtensions.cs b/ICD.Common.Utils/Extensions/EnumerableExtensions.cs index 174dc85..1d1269b 100644 --- a/ICD.Common.Utils/Extensions/EnumerableExtensions.cs +++ b/ICD.Common.Utils/Extensions/EnumerableExtensions.cs @@ -710,6 +710,24 @@ namespace ICD.Common.Utils.Extensions return new IcdHashSet(extends); } + /// + /// Returns the sequence as a IcdHashSet. + /// + /// + /// + /// + /// + public static IcdHashSet ToIcdHashSet(this IEnumerable extends, IEqualityComparer comparer) + { + if (extends == null) + throw new ArgumentNullException("extends"); + + if (comparer == null) + throw new ArgumentNullException("comparer"); + + return new IcdHashSet(comparer, extends); + } + /// /// Optimized ToArray implementation with fewer allocations. ///