public AssociativeArrayEnumerator(AssociativeArray ar) { _ar = ar; _currIndex = -1; _invalidated = false; // Subscribe to collection change events. AssociativeArray.ChangeEventHandler h; h = new AssociativeArray.ChangeEventHandler(InvalidatedHandler); ar.AddOnChanged(h); }
static void Main(string[] args) { AssociativeArray foodFavorites = new AssociativeArray(5); foodFavorites["Mickey"] = "Risotto with Wild Mushrooms"; foodFavorites["Ali"] = "Plain Cheeseburger"; foodFavorites["Mackenzie"] = "Macaroni and Cheese"; foodFavorites["Rene"] = "Escargots"; IEnumerator enumerator = foodFavorites.GetEnumerator(); enumerator.MoveNext(); foreach(string food in foodFavorites) { Console.WriteLine(food); } Iterate(foodFavorites); Console.WriteLine("done"); }