Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamically read Dictionary values

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
I have created a Dictionary Object using

Dictionary<string,string> DictList = new Dictionary<string,string>();


The object is populated.

How do I dynamically loop through it and read the keys and values ?

Please let me know.
Thank you.
 
Got it.

foreach (KeyValuePair<string, string> kvp in DictList)
{
Console.WriteLine("Key = {0}, Value = {1}",
kvp.Key, kvp.Value);
}

Thank you
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top