summaryrefslogtreecommitdiff
path: root/src/mscorlib/src/System/Collections/CompatibleComparer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/mscorlib/src/System/Collections/CompatibleComparer.cs')
-rw-r--r--src/mscorlib/src/System/Collections/CompatibleComparer.cs44
1 files changed, 27 insertions, 17 deletions
diff --git a/src/mscorlib/src/System/Collections/CompatibleComparer.cs b/src/mscorlib/src/System/Collections/CompatibleComparer.cs
index e5d3961..1c90707 100644
--- a/src/mscorlib/src/System/Collections/CompatibleComparer.cs
+++ b/src/mscorlib/src/System/Collections/CompatibleComparer.cs
@@ -6,39 +6,45 @@
using System.Diagnostics.Contracts;
-namespace System.Collections {
-
+namespace System.Collections
+{
[Serializable]
- internal class CompatibleComparer: IEqualityComparer {
- IComparer _comparer;
+ internal class CompatibleComparer : IEqualityComparer
+ {
+ private IComparer _comparer;
#pragma warning disable 618
- IHashCodeProvider _hcp;
+ private IHashCodeProvider _hcp;
- internal CompatibleComparer(IComparer comparer, IHashCodeProvider hashCodeProvider) {
+ internal CompatibleComparer(IComparer comparer, IHashCodeProvider hashCodeProvider)
+ {
_comparer = comparer;
_hcp = hashCodeProvider;
}
#pragma warning restore 618
- public int Compare(Object a, Object b) {
+ public int Compare(Object a, Object b)
+ {
if (a == b) return 0;
if (a == null) return -1;
if (b == null) return 1;
if (_comparer != null)
- return _comparer.Compare(a,b);
+ return _comparer.Compare(a, b);
IComparable ia = a as IComparable;
if (ia != null)
return ia.CompareTo(b);
- throw new ArgumentException(Environment.GetResourceString("Argument_ImplementIComparable"));
+ throw new ArgumentException(SR.Argument_ImplementIComparable);
}
- public new bool Equals(Object a, Object b) {
- return Compare(a, b) == 0;
+ public new bool Equals(Object a, Object b)
+ {
+ return Compare(a, b) == 0;
}
- public int GetHashCode(Object obj) {
- if( obj == null) {
+ public int GetHashCode(Object obj)
+ {
+ if (obj == null)
+ {
throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
@@ -49,16 +55,20 @@ namespace System.Collections {
}
// These are helpers for the Hashtable to query the IKeyComparer infrastructure.
- internal IComparer Comparer {
- get {
+ internal IComparer Comparer
+ {
+ get
+ {
return _comparer;
}
}
// These are helpers for the Hashtable to query the IKeyComparer infrastructure.
#pragma warning disable 618
- internal IHashCodeProvider HashCodeProvider {
- get {
+ internal IHashCodeProvider HashCodeProvider
+ {
+ get
+ {
return _hcp;
}
}