I have problem with Dictionary(buzzCompaignsPerUserIntersets)
. I have dictionary (key = stringand value = ICollection), I want to remove from value of each key, campaign which verify condition here is the code that I used:
buzzCompaignsPerUserIntersets = Dictionary<string, ICollection<Buzzcompaign> ;
foreach(var dic_compaign in buzzCompaignsPerUserIntersets)
{
var listCompaign = buzzCompaignsPerUserIntersets[dic_compaign.Key];
for (int i = 0; i < listCompaign.Count(); i++)
{
if (listCompaign.ElementAt(i).MayaMembership.MayaProfile.MayaProfileId == profile_id)
buzzCompaignsPerUserIntersets[dic_compaign.Key].Remove(listCompaign.ElementAt(i));
}
}
with this code I have a strange result because I iterate over a dictionary from which I remove elements.