コード例 #1
0
 public override int GetHashCode()
 {
     var hashCode = new HashCodeBuilder();
     hashCode.Add(Name, StringComparer.OrdinalIgnoreCase);
     hashCode.Add(Value);
     return hashCode.ToHashCode();
 }
コード例 #2
0
        public static void HashCode_Combine_Add_2()
        {
            var hc = new HashCodeBuilder();

            hc.Add(1);
            hc.Add(2);
            Assert.AreEqual(hc.ToHashCode(), HashCodeBuilder.Combine(1, 2));
        }
コード例 #3
0
        public override int GetHashCode()
        {
            var hashCode = new HashCodeBuilder();

            hashCode.Add(Name, StringComparer.InvariantCultureIgnoreCase);
            hashCode.Add(Value);
            return(hashCode.ToHashCode());
        }
コード例 #4
0
        public override int GetHashCode()
        {
            var hashCode = new HashCodeBuilder();

            hashCode.Add(Keys);
            hashCode.Add(Labels);
            hashCode.Add(AsOf);
            hashCode.Add(Fields);
            return(hashCode.ToHashCode());
        }
コード例 #5
0
        public override int GetHashCode()
        {
            var hashCode = new HashCodeBuilder();

            hashCode.Add(Keys);
            hashCode.Add(Labels);
            hashCode.Add(AsOf);
            hashCode.Add(Fields);
            hashCode.Add(BatchLink, StringComparer.Ordinal);
            return(hashCode.ToHashCode());
        }
コード例 #6
0
        public static void HashCode_Add_GenericEqualityComparer()
        {
            var hc = new HashCodeBuilder();

            hc.Add(1);
            hc.Add("Hello", new ConstComparer());

            var expected = new HashCodeBuilder();

            expected.Add(1);
            expected.Add(ConstComparer.ConstantValue);

            Assert.AreEqual(expected.ToHashCode(), hc.ToHashCode());
        }
コード例 #7
0
        public static void HashCode_Add_NullEqualityComparer()
        {
            var hc = new HashCodeBuilder();

            hc.Add(1);
            hc.Add("Hello", null);

            var expected = new HashCodeBuilder();

            expected.Add(1);
            expected.Add("Hello");

            Assert.AreEqual(expected.ToHashCode(), hc.ToHashCode());
        }
        public int GetHashCode(OutputFieldMappingEntry obj)
        {
            if (obj is null)
            {
                return(0);
            }

            HashCodeBuilder builder = new HashCodeBuilder();

            builder.Add(obj.Name);
            builder.Add(obj.TargetName);

            return(builder.ToHashCode());
        }
コード例 #9
0
        public int GetHashCode(SearchIndexerSkillset obj)
        {
            if (obj is null)
            {
                return(0);
            }

            HashCodeBuilder builder = new HashCodeBuilder();

            builder.Add(obj.Name);
            builder.Add(obj.Description);
            builder.Add(obj.Skills, SharedSkillsCollection);

            return(builder.ToHashCode());
        }
コード例 #10
0
        public int GetHashCode(InputFieldMappingEntry obj)
        {
            if (obj is null)
            {
                return(0);
            }

            HashCodeBuilder builder = new HashCodeBuilder();

            builder.Add(obj.Name);
            builder.Add(obj.Source);
            builder.Add(obj.SourceContext);
            builder.Add(obj.Inputs, SharedInputsCollection);

            return(builder.ToHashCode());
        }
コード例 #11
0
        public int GetHashCode(SearchIndexerDataSourceConnection obj)
        {
            if (obj is null)
            {
                return(0);
            }

            HashCodeBuilder builder = new HashCodeBuilder();

            builder.Add(obj.Name);
            builder.Add(obj.Type);
            builder.Add(obj.Description);
            builder.Add(obj.Container?.Name);
            builder.Add(obj.Container?.Query);

            return(builder.ToHashCode());
        }
コード例 #12
0
        public int GetHashCode(SearchIndexerSkill obj)
        {
            if (obj is null)
            {
                return(0);
            }

            HashCodeBuilder builder = new HashCodeBuilder();

            // BUGBUG: Ignore the name since 1-based automatic names are only returned in GET methods, not PUT methods.
            builder.Add(obj.ODataType);
            builder.Add(obj.Description);
            builder.Add(obj.Context);
            builder.Add(obj.Inputs, SharedInputsCollection);
            builder.Add(obj.Outputs, SharedOutputsCollection);

            return(builder.ToHashCode());
        }
コード例 #13
0
        public static void HashCode_Add_HashCode()
        {
            var hc1 = new HashCodeBuilder();

            hc1.Add("Hello");

            var hc2 = new HashCodeBuilder();

            hc2.Add("Hello".GetHashCode());

            Assert.AreEqual(hc1.ToHashCode(), hc2.ToHashCode());
        }
コード例 #14
0
        public static void HashCode_Add_Null()
        {
            var hc = new HashCodeBuilder();

            hc.Add <string>(null);

            var expected = new HashCodeBuilder();

            expected.Add(EqualityComparer <string> .Default.GetHashCode(null));

            Assert.AreEqual(expected.ToHashCode(), hc.ToHashCode());
        }
コード例 #15
0
        public int GetHashCode(ConfigurationSetting setting)
        {
            var hashCode = new HashCodeBuilder();

            hashCode.Add(setting.Key, StringComparer.Ordinal);
            hashCode.Add(setting.Label, StringComparer.Ordinal);
            hashCode.Add(setting.Value, StringComparer.Ordinal);
            hashCode.Add(setting.ContentType, StringComparer.Ordinal);
            hashCode.Add(setting.LastModified);
            hashCode.Add(setting.ETag);
            hashCode.Add(setting.ReadOnly);
            hashCode.Add(setting.Tags);
            return(hashCode.ToHashCode());
        }
コード例 #16
0
        public static void HashCode_Combine_Add_8()
        {
            var hc = new HashCodeBuilder();

            hc.Add(1);
            hc.Add(2);
            hc.Add(3);
            hc.Add(4);
            hc.Add(5);
            hc.Add(6);
            hc.Add(7);
            hc.Add(8);
            Assert.AreEqual(hc.ToHashCode(), HashCodeBuilder.Combine(1, 2, 3, 4, 5, 6, 7, 8));
        }
コード例 #17
0
        public int GetHashCode(ICollection <T> obj)
        {
            if (obj is null)
            {
                return(0);
            }

            HashCodeBuilder builder = new HashCodeBuilder();

            foreach (T element in obj)
            {
                builder.Add(element, ElementComparer);
            }

            return(builder.ToHashCode());
        }
コード例 #18
0
ファイル: TimeoutEvent.cs プロジェクト: galpin/mg.simulation
 protected override int GetHashCodeCore(HashCodeBuilder builder)
 {
     return(builder.Add(GeneratedOn).Add(Delay));
 }
コード例 #19
0
        public int GetHashCode(SearchField obj)
        {
            if (obj is null)
            {
                return(0);
            }

            HashCodeBuilder builder = new HashCodeBuilder();

            builder.Add(obj.Name);
            builder.Add(obj.Type);
            builder.Add(obj.IsKey);
            builder.Add(obj.IsHidden);
            builder.Add(obj.IsSearchable);
            builder.Add(obj.IsFilterable);
            builder.Add(obj.IsSortable);
            builder.Add(obj.IsFacetable);
            builder.Add(obj.Analyzer);
            builder.Add(obj.SearchAnalyzer);
            builder.Add(obj.IndexAnalyzer);
            builder.Add(obj.SynonymMaps, CollectionComparer <string> .Shared);
            builder.Add(obj.Fields, SharedFieldsCollection);

            return(builder.ToHashCode());
        }