/// <summary> /// Check that this bag and another bag were created with the same comparison /// mechanism. Throws exception if not compatible. /// </summary> /// <param name="otherBag">Other bag to check comparision mechanism.</param> /// <exception cref="InvalidOperationException">If otherBag and this bag don't use the same method for comparing items.</exception> private void CheckConsistentComparison(Bag <T> otherBag) { otherBag.ShouldNotBeNull("otherBag"); Guard.Assert(Equals(_equalityComparer, otherBag._equalityComparer), Strings.InconsistentComparisons); }