예제 #1
0
 /// <summary>
 /// Returns the hashcode of this Object
 /// </summary>
 /// <returns>Hash code (int)</returns>
 public override int GetHashCode()
 {
     // Credit: http://stackoverflow.com/a/263416/677735
     unchecked             // Overflow is fine, just wrap
     {
         int hash = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hash = hash * 59 + Id.GetHashCode();
         }
         if (LogMessageTypeId != null)
         {
             hash = hash * 59 + LogMessageTypeId.GetHashCode();
         }
         if (ApplicationName != null)
         {
             hash = hash * 59 + ApplicationName.GetHashCode();
         }
         if (ApplicationMethod != null)
         {
             hash = hash * 59 + ApplicationMethod.GetHashCode();
         }
         if (IpAddress != null)
         {
             hash = hash * 59 + IpAddress.GetHashCode();
         }
         if (LoginToken != null)
         {
             hash = hash * 59 + LoginToken.GetHashCode();
         }
         if (ShortMessage != null)
         {
             hash = hash * 59 + ShortMessage.GetHashCode();
         }
         if (RequestHttpMethod != null)
         {
             hash = hash * 59 + RequestHttpMethod.GetHashCode();
         }
         if (RequestUri != null)
         {
             hash = hash * 59 + RequestUri.GetHashCode();
         }
         if (RequestParams != null)
         {
             hash = hash * 59 + RequestParams.GetHashCode();
         }
         if (RequestBody != null)
         {
             hash = hash * 59 + RequestBody.GetHashCode();
         }
         if (StatusCode != null)
         {
             hash = hash * 59 + StatusCode.GetHashCode();
         }
         if (ResponseContent != null)
         {
             hash = hash * 59 + ResponseContent.GetHashCode();
         }
         if (FullMessage != null)
         {
             hash = hash * 59 + FullMessage.GetHashCode();
         }
         if (Exception != null)
         {
             hash = hash * 59 + Exception.GetHashCode();
         }
         if (Trace != null)
         {
             hash = hash * 59 + Trace.GetHashCode();
         }
         if (Logged != null)
         {
             hash = hash * 59 + Logged.GetHashCode();
         }
         return(hash);
     }
 }
예제 #2
0
        public override int GetHashCode()
        {
            int result = 17;

            unchecked
            {
                if (RuleId != null)
                {
                    result = (result * 31) + RuleId.GetHashCode();
                }

                result = (result * 31) + Kind.GetHashCode();
                if (FullMessage != null)
                {
                    result = (result * 31) + FullMessage.GetHashCode();
                }

                if (ShortMessage != null)
                {
                    result = (result * 31) + ShortMessage.GetHashCode();
                }

                if (FormattedMessage != null)
                {
                    result = (result * 31) + FormattedMessage.GetHashCode();
                }

                if (Locations != null)
                {
                    foreach (var value_0 in Locations)
                    {
                        result = result * 31;
                        if (value_0 != null)
                        {
                            result = (result * 31) + value_0.GetHashCode();
                        }
                    }
                }

                if (ToolFingerprint != null)
                {
                    result = (result * 31) + ToolFingerprint.GetHashCode();
                }

                if (Stacks != null)
                {
                    foreach (var value_1 in Stacks)
                    {
                        result = result * 31;
                        if (value_1 != null)
                        {
                            foreach (var value_2 in value_1)
                            {
                                result = result * 31;
                                if (value_2 != null)
                                {
                                    result = (result * 31) + value_2.GetHashCode();
                                }
                            }
                        }
                    }
                }

                if (CodeFlows != null)
                {
                    foreach (var value_3 in CodeFlows)
                    {
                        result = result * 31;
                        if (value_3 != null)
                        {
                            foreach (var value_4 in value_3)
                            {
                                result = result * 31;
                                if (value_4 != null)
                                {
                                    result = (result * 31) + value_4.GetHashCode();
                                }
                            }
                        }
                    }
                }

                if (RelatedLocations != null)
                {
                    foreach (var value_5 in RelatedLocations)
                    {
                        result = result * 31;
                        if (value_5 != null)
                        {
                            result = (result * 31) + value_5.GetHashCode();
                        }
                    }
                }

                result = (result * 31) + IsSuppressedInSource.GetHashCode();
                if (Fixes != null)
                {
                    foreach (var value_6 in Fixes)
                    {
                        result = result * 31;
                        if (value_6 != null)
                        {
                            result = (result * 31) + value_6.GetHashCode();
                        }
                    }
                }

                if (Properties != null)
                {
                    // Use xor for dictionaries to be order-independent.
                    int xor_0 = 0;
                    foreach (var value_7 in Properties)
                    {
                        xor_0 ^= value_7.Key.GetHashCode();
                        if (value_7.Value != null)
                        {
                            xor_0 ^= value_7.Value.GetHashCode();
                        }
                    }

                    result = (result * 31) + xor_0;
                }

                if (Tags != null)
                {
                    foreach (var value_8 in Tags)
                    {
                        result = result * 31;
                        if (value_8 != null)
                        {
                            result = (result * 31) + value_8.GetHashCode();
                        }
                    }
                }
            }

            return(result);
        }