diff --git a/ShittyLINQ/ToHashSet.cs b/ShittyLINQ/ToHashSet.cs
new file mode 100644
index 0000000..01cd198
--- /dev/null
+++ b/ShittyLINQ/ToHashSet.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace ShittyLINQ
+{
+ public static partial class Extensions
+ {
+ ///
+ /// Returns a of the source items.
+ ///
+ /// Type of elements in source sequence.
+ /// Source sequence
+ /// A hash set of the items in the sequence.
+ /// is null
+ public static HashSet ToHashSet(this IEnumerable source)
+ {
+ if (source == null) throw new ArgumentNullException();
+ return new HashSet(source);
+ }
+ }
+}
diff --git a/ShittyLinqTests/ToHashSetTests.cs b/ShittyLinqTests/ToHashSetTests.cs
new file mode 100644
index 0000000..abf25ff
--- /dev/null
+++ b/ShittyLinqTests/ToHashSetTests.cs
@@ -0,0 +1,27 @@
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using ShittyLINQ;
+using ShittyTests.TestHelpers;
+using System;
+using System.Collections.Generic;
+
+namespace ShittyLinqTests
+{
+ [TestClass]
+ public class ToHashSetTests
+ {
+ [TestMethod]
+ public void ToHashSet_SequenceIsNull()
+ {
+ IEnumerable nums = null;
+ Assert.ThrowsException(() => nums.ToHashSet());
+ }
+
+ [TestMethod]
+ public void ToHashSet_SequenceEquals()
+ {
+ var expected = new int[] { 0, 1, 2 };
+ var actual = expected.ToHashSet();
+ TestHelper.AssertCollectionsAreSame(expected, actual);
+ }
+ }
+}