Example #1
0
        public static void Main()
        {
            var set = new HashedSet<int>();

            for (int i = 1; i < 11; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    set.Add(i);
                }
            }

            System.Console.WriteLine(set);
            System.Console.WriteLine(set.Count);

            var otherSet = new HashedSet<int>();

            for (int i = 5; i < 16; i++)
            {
                otherSet.Add(i);
            }

            System.Console.WriteLine(otherSet);
            System.Console.WriteLine(otherSet.Count);
            System.Console.WriteLine(set.IntersectsWith(otherSet));
            System.Console.WriteLine(set.Union(otherSet));
        }
Example #2
0
        public static void Main()
        {
            var set = new HashedSet <int>();

            for (int i = 1; i < 11; i++)
            {
                for (int j = 0; j < 3; j++)
                {
                    set.Add(i);
                }
            }

            System.Console.WriteLine(set);
            System.Console.WriteLine(set.Count);

            var otherSet = new HashedSet <int>();

            for (int i = 5; i < 16; i++)
            {
                otherSet.Add(i);
            }

            System.Console.WriteLine(otherSet);
            System.Console.WriteLine(otherSet.Count);
            System.Console.WriteLine(set.IntersectsWith(otherSet));
            System.Console.WriteLine(set.Union(otherSet));
        }
        public void ShouldReturnCorrectIntersection()
        {
            var set = new HashedSet<int>();
            set.Add(1);
            set.Add(2);
            var otherSet = new HashedSet<int>();
            otherSet.Add(2);
            otherSet.Add(3);

            CollectionAssert.AreEqual(new[] { 2 }, set.IntersectsWith(otherSet));
        }
Example #4
0
        public void ShouldReturnCorrectIntersection()
        {
            var set = new HashedSet <int>();

            set.Add(1);
            set.Add(2);
            var otherSet = new HashedSet <int>();

            otherSet.Add(2);
            otherSet.Add(3);

            CollectionAssert.AreEqual(new[] { 2 }, set.IntersectsWith(otherSet));
        }