//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); }
public bool Contains(TInput row) { HashValue hashValue = new HashValue(HashSumFunc(row));//row.GetHashCode(); //hashValue.Hash = CalculateHashForProperties(row, TypeInfo.Properties); return(Cache.Contains(hashValue)); }
public override bool Equals(object obj) { HashValue comp = obj as HashValue; if (comp == null) { return(false); } return(comp.Hash == this.Hash); }