コード例 #1
0
ファイル: Endpoint.cs プロジェクト: Chatham/LetsTrace.Zipkin
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (ServiceName != null)
         {
             hashCode = hashCode * 59 + ServiceName.GetHashCode();
         }
         if (Ipv4 != null)
         {
             hashCode = hashCode * 59 + Ipv4.GetHashCode();
         }
         if (Ipv6 != null)
         {
             hashCode = hashCode * 59 + Ipv6.GetHashCode();
         }
         if (Port != null)
         {
             hashCode = hashCode * 59 + Port.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #2
0
        public override int GetHashCode()
        {
            int h = 1;

            h *= 1000003;
            h ^= (ServiceName == null) ? 0 : ServiceName.GetHashCode();
            h *= 1000003;
            h ^= (Ipv4 == null) ? 0 : Ipv4.GetHashCode();
            h *= 1000003;
            h ^= (Ipv6 == null) ? 0 : Ipv6.GetHashCode();
            h *= 1000003;
            h ^= Port.GetHashCode();
            return(h);
        }