C# Coffee Time Code Project
I solved the last Code Project in this way: int discount = 10; //Convert.ToInt32(Console.ReadLine()); Dictionary<string, int> coffee = new Dictionary<string, int>(); coffee.Add("Americano", 50); coffee.Add("Latte", 70); coffee.Add("Flat White", 60); coffee.Add("Espresso", 60); coffee.Add("Cappuccino", 80); coffee.Add("Mocha", 90); foreach (var item in coffee) { Console.WriteLine(item.Key + ": " + (item.Value - (item.Value * discount / 100))); } but others solve the foreach like this: //foreach (KeyValuePair<string, int> entry in coffee) //{ // Console.WriteLine(entry.Key + ": " + (entry.Value - entry.Value * discount / 100)); //} what is the difference? Is it the performance?