コード例 #1
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((_currencyPair.GetHashCode() * 397) ^ _side.GetHashCode());
     }
 }
コード例 #2
0
        public void GetHashCode_TwoDifferentCurrencyPairs_AreNotEqual()
        {
            var pair1 = new CurrencyPair("BTC", "USD");
            var pair2 = new CurrencyPair("ETH", "USD");

            Assert.NotEqual(pair1.GetHashCode(), pair2.GetHashCode());
        }
コード例 #3
0
        public void GetHashCode_TwoIdenticalCurrencyPairs_AreEqual()
        {
            var pair1 = new CurrencyPair("BTC", "USD");
            var pair2 = new CurrencyPair("BTC", "USD");

            Assert.Equal(pair1.GetHashCode(), pair2.GetHashCode());
        }
コード例 #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         return(((CurrencyPair != null ? CurrencyPair.GetHashCode() : 0) * 397) ^ Timestamp.GetHashCode());
     }
 }
コード例 #5
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                var hashCode = 41;
                // Suitable nullity checks etc, of course :)
                if (CallsVolume != null)
                {
                    hashCode = hashCode * 59 + CallsVolume.GetHashCode();
                }
                if (PutsVolume != null)
                {
                    hashCode = hashCode * 59 + PutsVolume.GetHashCode();
                }

                hashCode = hashCode * 59 + CurrencyPair.GetHashCode();
                if (FuturesVolume != null)
                {
                    hashCode = hashCode * 59 + FuturesVolume.GetHashCode();
                }
                return(hashCode);
            }
        }
コード例 #6
0
 public override int GetHashCode()
 {
     return(CurrencyPair.GetHashCode());
 }