here is some of my code:
Dictionary<Int32, Dictionary<Int32, List<Int32>>> Staffs = new Dictionary<int, Dictionary<int, List<int>>>();
and:
if (!Staffs.Keys.Contains(staff))
{
Staffs.Add(staff, new Dictionary<int, List<int>>());
}
if (!Staffs[staff].Keys.Contains(triad))
{
Staffs[staff].Add(triad, new List<int>());
}
if (Staffs[staff][triad].Count >= 4)
{
if(myVar.sitnote)
MessageBox.Show("Maximum notes reached");
return;
}
...and...:
Staffs[staff][triad].Add(noteloc);
and then:
foreach (int value in Staffs[1][1])
{
if (value == noteloc)
{
hi = true;
qq = value;
}
}
if (hi)
Staffs[1][1].Remove(qq);
//---------------------------------------------------------------
I added 3 Items in the list inner the dictionary
when I remove one of them :count of the list=2
but when I add 4 Items ,after remove Item I have :count=4
what can I do?
What I have tried:
I know the problem is for "return" in:
if (Staffs[staff][triad].Count >= 4)
{
if(myVar.sitnote)
MessageBox.Show("Maximum notes reached");
return;
But I don't know what can I do