private WalletBalance(string wallet, WalletBalance previous) : this(wallet) { if (previous != null) { Balance = previous.Balance; } }
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)); }
private WalletBalance(string wallet, WalletBalance previous, ImmutableDictionary <string, decimal> dictionary) : this(wallet, previous) { Balance = dictionary; }