I have a dictionary with a Person and a Count value:
Dictionary<string, int> PersonDictionary = new Dictionary<string, int>();
It has the following values:
Sally, 6
Beth, 5
Mary, 5
I want to alternate each person and decrement the value by 1 each time it goes through the loop. I'm running into a real mind block on this one
What is the best way to get Sally and decrement by 1 and then go to Beth and decrement by 1 and then go to Mary and decrement by 1 and then go back to Sally... So on and so forth.
Just add further clarification I want to loop through this and use the owner.Key
value and pass that to another method. So I need to be able to loop through this dictionary 1 at a time.
Update:
There are a few issues with my question. One issue was the decrementing the dictionary while in a loop. But my main question was how to iterate through each item [Sally -> Beth -> Mary -> Sally
) until each persons value goes to 0 - That part is still the question at large.