07 July 2011

.NET - Foreach loop through a Dictionary

Looping a Dictionary<key, value> list using C#.NET is easy enough.
You just need to know how, and this is how:
private Dictionary<int, Customer> DataSupport { get; set; }

foreach (KeyValuePair<int, Customer> customer in DataSupport) {
  int key = customer.Key;
  Customer value = customer.Value;
}

No comments:

Post a Comment