I have a Dictionary<string, int>
ad I'd like to amend the int
.
I am unable to do so as it's read only.
My effort is
using System;
using System.Linq;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
var itemInList = new Dictionary<string, int>();
itemInList.Add("a", 0);
var existing = itemInList.SingleOrDefault(a => a.Key == "a");
existing.Value++; //fails
}
}
I don't understand what I need to do to fix this