I'm using a dictionary to store my Foo classes.
class Foo
{
int i = 0;
public void Update()
{
i++;
}
}
Dictionary<string, Foo> fooDictionary = new Dictionary<string, Foo>();
The dictionary contains
fooDictionary.Add("MrFoo", new Foo());
fooDictionary.Add("MrsFoo", new Foo());
fooDictionary.Add("BabyFoo", new Foo());
How can I iterate through the dictionary without using foreach and call the Update method for all the Foo classes stored?
for (int i = 0; i < fooDictionary.Count; ++i)
{
//fooDictionary[i].Update();
}