Using Newston.Json to Store Balances to Bank Account. When I add new entry, it replaces the old one, I want to append key value pairs to existing notepad file, instead it replaces the old balances.
Key = Bank Name with Account
Value = Balance
Global Variable
List<KeyValuePair<string, float>> vals3 = new List<KeyValuePair<string, float>>();
// Now Add Balance to Accounts
BankWithAccount = BankList.Text + AccountNotextBox1.Text;
balance = float.Parse(BalanceTxtBox.Text);
vals3.Add(new KeyValuePair<string, float>(BankWithAccount, balance));
using (StreamWriter sw = File.CreateText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Balances.txt")))
{
string json = JsonConvert.SerializeObject(vals3);
sw.Write(json);
}