コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = HashConstants.OffsetBasis;
         hashCode = (hashCode ^ (FeatureModel.GetHashCode())) * HashConstants.Prime;
         foreach (var gene in Genes.OrderBy(g => g.FeatureId))
         {
             hashCode = (hashCode ^ (gene.GetHashCode())) * HashConstants.Prime;
         }
         return(hashCode);
     }
 }
コード例 #2
0
        public void GetHashCode_ReturnsSame_ForReversedFeaturesFeatureModel()
        {
            var identicalFeatureModel = new FeatureModel(_features.Reverse().ToArray(), _relations.Reverse().ToArray());

            Assert.AreEqual(_featureModel.GetHashCode(), identicalFeatureModel.GetHashCode());
        }