Example #1
0
        public int GetKey(DataField dataField)
        {
            var key = dataField.GetHashCode();

            if (flyweights.ContainsKey(key))
            {
                return(key);
            }
            else
            {
                flyweights.Add(key, dataField);
                return(key);
            }
        }
Example #2
0
        public void GetHashcodeTest()
        {
            DataField dataField1 = new DataField();

            dataField1.FieldName  = "test-fieldName";
            dataField1.Value      = "test-value";
            dataField1.FieldGroup = "test-fieldGroup";

            DataField dataField2 = new DataField();

            dataField2.FieldName  = "test-fieldName";
            dataField2.Value      = "test-value";
            dataField2.FieldGroup = "test-fieldGroup";

            Assert.Equal(dataField1.GetHashCode(), dataField2.GetHashCode());
        }
Example #3
0
 public override int GetHashCode()
 {
     return(field != null?field.GetHashCode() : strongField.GetHashCode());
 }