After completing a task in Java, I have now been required to produce the same results in C# and I am in need of some help. The object that I am using is:
Dictionary<int, Dictionary<String, List<int>>> full_map = new Dictionary<int, Dictionary<String, List<int>>>();
I want to add an entry to the inner dictionary if I already have something stored at the main dictionary's key.
To handle this, I started with the logic,
if (full_map.ContainsKey(int.Parse(pop_cy_st_intrst[0])))
{
Dictionary<String, List<int>> temp = new Dictionary<String, List<int>>();
//this is the logic I can't figure out.
}
else
{
full_map.Add(int.Parse(pop_cy_st_intrst[0]), temp_entry);
}
My thought process for the if statement was to store the existing dictionary in the temp and add the new entry to it. Then, put the updated dictionary back at the key location but it keeps throwing me errors.