internal InternalEqualityComparer(EqualityComparison <Object> equals, GetHashCode <Object> getHashCode)
        {
            Throw.If.Object.IsNull(equals, nameof(equals));
            Throw.If.Object.IsNull(getHashCode, nameof(getHashCode));

            _equals      = equals;
            _getHashCode = getHashCode;
        }
Example #2
0
 public static int Main(string[] args)
 {
     GetHashCode ghc = new GetHashCode();
     if (ghc.RunTests())
     {
         TestFramework.LogInformation("PASSED");
         return 100;
     }
     else
     {
         TestFramework.LogInformation("FAILED");
         return 99;
     }
 }
Example #3
0
    public static int Main(string[] args)
    {
        GetHashCode ghc = new GetHashCode();

        if (ghc.RunTests())
        {
            TestFramework.LogInformation("PASSED");
            return(100);
        }
        else
        {
            TestFramework.LogInformation("FAILED");
            return(99);
        }
    }
Example #4
0
 public override string ToString()
 {
     return
         ($"{GetType()}#{GetHashCode()}{(onEnter == null ? "" : " onEnter")}{(onHover == null ? "" : " onHover")}{(onExit == null ? "" : " onExit")}");
 }
        /// <summary>
        /// Returns a new instance of <see cref="IEqualityComparer{T}"/> using the given
        /// <see cref="EqualityComparison{T}"/> and  <see cref="GetHashCode{T}"/>.
        /// </summary>
        /// <typeparam name="T">The type of the objects to compare.</typeparam>
        /// <param name="equals">The <see cref="EqualityComparison{T}"/> to use for calls of <c>IEqualityComparer&lt;T&gt;.Equals(T, T)</c>.</param>
        /// <param name="getHashCode">The <see cref="GetHashCode{T}"/> to use for calls of <c>IEqualityComparer&lt;T&gt;.GetHashCode(T)</c>.</param>
        /// <returns>A new instance of <see cref="IEqualityComparer{T}"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="equals"/> is null.</exception>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="getHashCode"/> is null.</exception>
        public static IEqualityComparer <T> FromDelegate <T>(EqualityComparison <T> equals, GetHashCode <T> getHashCode)
        {
            Throw.If.Object.IsNull(equals, nameof(equals));
            Throw.If.Object.IsNull(getHashCode, nameof(getHashCode));

            return(new InternalEqualityComparer <T>(equals, getHashCode));
        }
Example #6
0
 public SpanDictionary(GetHashCode getHashCode)
 {
     _getHashCode = getHashCode;
 }