コード例 #1
0
 /// <summary>
 /// Indicates whether the current object is equal to another object of the same type.
 /// </summary>
 /// <param name="other">
 /// An object to compare with this object.
 /// </param>
 /// <returns>
 /// true if the current object is equal to the other parameter; otherwise, false.
 /// </returns>
 public bool Equals(TSelf other)
 {
     if (other == null || GetType() != other.GetType())
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(DelegateCache.EqualsDelegate((TSelf)this, other));
 }
コード例 #2
0
 public static bool Equals <T>(T self, object other)
 {
     if (other is null)
     {
         return(false);
     }
     if (self.GetType() != other.GetType())
     {
         return(false);
     }
     if (other is T value)
     {
         return(DelegateCache <T> .EqualsDelegate(self, value));
     }
     return(false);
 }