コード例 #1
0
ファイル: Rule.cs プロジェクト: MShaffar19/bion
        public override int GetHashCode()
        {
            int result = 17;

            unchecked
            {
                if (Id != default(string))
                {
                    result = (result * 31) + Id.GetHashCode();
                }

                if (Guid != default(String))
                {
                    result = (result * 31) + Guid.GetHashCode();
                }

                if (HelpUri != default(Uri))
                {
                    result = (result * 31) + HelpUri.GetHashCode();
                }

                if (RelatedRules != default(IList <Rule>))
                {
                    result = (result * 31) + RelatedRules.GetHashCode();
                }
            }

            return(result);
        }
コード例 #2
0
        public override int GetHashCode()
        {
            int result = 17;

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

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

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

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

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

                    result = (result * 31) + xor_0;
                }

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

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

                    result = (result * 31) + xor_1;
                }

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

            return(result);
        }