I'm wondering of there is a way to update my dictionary if the key exists, adding more elements to vale. Something like this is the idea:
var dic = new Dictionary<int, object>();
foreach(var item in Fields)
if(dic.ContainsKey(item.Key)){
// here will go the logic
}
For example, I have a key 0 with an array of 4 values. Then, when I go to that code I want that if key 0 exist then my array will be overwrite to an array of the 4 elements and another 4 elements (8 in total) and go on. Is it possible?
EDIT: I finally made it this way:
var dic = new Dictionary<int, object>();
foreach(var item in Fields)
if(dic.ContainsKey(item.Key))
{
var temp = new Array[4]{1, 2, 3, 4};
var temp2 = dic[item.Key];
var len = temp.Length + temp2.Count();
var rs = new object[len];
for(int i=0; i<len/2; i++)
rs[i] = temp;
for(int i = len/2; i<len;i++)
rs[i] = temp2;
dic[item.Key] = rs;
}