Пример #1
0
        //private int CalculateHashForProperties(TInput row, PropertyInfo[] properties)
        //{
        //    int hash = 29;
        //    unchecked
        //    {
        //        foreach (var prop in properties)
        //            hash = hash * 486187739 + (prop.GetValue(row)?.GetHashCode() ?? 17);
        //        return hash;
        //    }
        //}

        public void Add(TInput row)
        {
            HashValue hashValue = new HashValue(HashSumFunc(row));//row.GetHashCode();

            //hashValue.Hash = CalculateHashForProperties(row, TypeInfo.Properties);
            Cache.Add(hashValue);
        }
Пример #2
0
        public bool Contains(TInput row)
        {
            HashValue hashValue = new HashValue(HashSumFunc(row));//row.GetHashCode();

            //hashValue.Hash = CalculateHashForProperties(row, TypeInfo.Properties);
            return(Cache.Contains(hashValue));
        }
Пример #3
0
        public override bool Equals(object obj)
        {
            HashValue comp = obj as HashValue;

            if (comp == null)
            {
                return(false);
            }
            return(comp.Hash == this.Hash);
        }