summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Collections/StructuralComparisons.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Collections/StructuralComparisons.cs')
-rw-r--r--src/mscorlib/src/System/Collections/StructuralComparisons.cs89
1 files changed, 0 insertions, 89 deletions
diff --git a/src/mscorlib/src/System/Collections/StructuralComparisons.cs b/src/mscorlib/src/System/Collections/StructuralComparisons.cs
deleted file mode 100644
index 685af59..0000000
--- a/src/mscorlib/src/System/Collections/StructuralComparisons.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-//
-
-using System;
-
-namespace System.Collections {
- public static class StructuralComparisons {
-
- private static volatile IComparer s_StructuralComparer;
- private static volatile IEqualityComparer s_StructuralEqualityComparer;
-
- public static IComparer StructuralComparer {
- get {
- IComparer comparer = s_StructuralComparer;
- if (comparer == null) {
- comparer = new StructuralComparer();
- s_StructuralComparer = comparer;
- }
- return comparer;
- }
- }
-
- public static IEqualityComparer StructuralEqualityComparer {
- get {
- IEqualityComparer comparer = s_StructuralEqualityComparer;
- if (comparer == null) {
- comparer = new StructuralEqualityComparer();
- s_StructuralEqualityComparer = comparer;
- }
- return comparer;
- }
- }
- }
-
- [Serializable]
- internal class StructuralEqualityComparer : IEqualityComparer {
- public new bool Equals(Object x, Object y) {
- if (x != null) {
-
- IStructuralEquatable seObj = x as IStructuralEquatable;
-
- if (seObj != null){
- return seObj.Equals(y, this);
- }
-
- if (y != null) {
- return x.Equals(y);
- } else {
- return false;
- }
- }
- if (y != null) return false;
- return true;
- }
-
- public int GetHashCode(Object obj) {
- if (obj == null) return 0;
-
- IStructuralEquatable seObj = obj as IStructuralEquatable;
-
- if (seObj != null) {
- return seObj.GetHashCode(this);
- }
-
- return obj.GetHashCode();
- }
- }
-
- [Serializable]
- internal class StructuralComparer : IComparer {
- public int Compare(Object x, Object y) {
-
- if (x == null) return y == null ? 0 : -1;
- if (y == null) return 1;
-
- IStructuralComparable scX = x as IStructuralComparable;
-
- if (scX != null) {
- return scX.CompareTo(y, this);
- }
-
- return Comparer.Default.Compare(x, y);
- }
- }
-
-}