24 lines
650 B
C#
24 lines
650 B
C#
|
using System.Collections.Generic;
|
|||
|
using System.Runtime.CompilerServices;
|
|||
|
|
|||
|
namespace LeanCloud.Storage.Internal
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// An equality comparer that uses the object identity (i.e. ReferenceEquals)
|
|||
|
/// rather than .Equals, allowing identity to be used for checking equality in
|
|||
|
/// ISets and IDictionaries.
|
|||
|
/// </summary>
|
|||
|
public class IdentityEqualityComparer<T> : IEqualityComparer<T>
|
|||
|
{
|
|||
|
public bool Equals(T x, T y)
|
|||
|
{
|
|||
|
return object.ReferenceEquals(x, y);
|
|||
|
}
|
|||
|
|
|||
|
public int GetHashCode(T obj)
|
|||
|
{
|
|||
|
return RuntimeHelpers.GetHashCode(obj);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|