Add reference equality check to SetEquals methods.

The SetEquals methods are rather expensive, and it's a quick and super-effective check to compare reference equality between the two collections before engaging in the expensive work.
Should you add one? If we were to code cover guy, we wouldn’t hit it. :)

From: Andrew Arnott [mailto:notifications@github.com]
Sent: Sunday, November 16, 2014 9:22 PM
To: dotnet/corefx
Cc: David Kean
Subject: Re: [corefx] Add reference equality check to SetEquals methods. (#107)


In src/System.Collections.Immutable/tests/ImmutableSetTest.cs:

> @@ -292,6 +292,7 @@ private IEnumerable<SetTriad> GetSetEqualsScenarios()

>                  new SetTriad(SetWith<int>(), new int[] { 5 }, false),

>                  new SetTriad(SetWith<int>(5, 8), new int[] { 5 }, false),

>                  new SetTriad(SetWith<int>(5), new int[] { 5, 8 }, false),

> +                new SetTriad(SetWith<int>(5, 8), SetWith<int>(5, 8), true),

This doesn't test reference equality. I just realized in the creation of this change that we didn't have any set equality tests that took a set as the argument -- they were always just arrays. So this particular additional line causes an equivalent set (not reference equal) to be tested as an argument.

—
Reply to this email directly or view it on GitHub<https://github.com/dotnet/corefx/pull/107/files#r20418909>.