So I am looping through some objects and initializing a Dictionary> object.
So first I check if the key exists, if it does I will add to the List
If it doesn't, I will create a new key and new List
Is that the right logic?
I will have to do a:
new List<int>();
the first time I insert an item right?
i.e.:
if(myDic.ContainsKey(car.ID))
{
myDic[car.ID].Add(car.MfgID);
}
else
{
myDic.Add(car.ID, new List<int>);
myDic[car.ID].Add(car.MfgID);
}