예제 #1
0
 private WalletBalance(string wallet, WalletBalance previous)
     : this(wallet)
 {
     if (previous != null)
     {
         Balance = previous.Balance;
     }
 }
예제 #2
0
        public Balance ChangeBalance(string wallet, string asset, decimal change)
        {
            var dictionary = WalletDictionary;

            if (dictionary.ContainsKey(wallet))
            {
                dictionary = dictionary.SetItem(wallet, dictionary[wallet].ChangeBalance(asset, change));
            }
            else
            {
                var balance = new WalletBalance(wallet);
                balance    = balance.ChangeBalance(asset, change);
                dictionary = dictionary.Add(wallet, balance);
            }

            return(new Balance(this, dictionary));
        }
예제 #3
0
 private WalletBalance(string wallet, WalletBalance previous, ImmutableDictionary <string, decimal> dictionary)
     : this(wallet, previous)
 {
     Balance = dictionary;
 }