I’m new to Lambda expressions so have been experimenting from an hour.
I have a generic list – List<KeyValuePair<int, string>> basically holding a key
and a value pair. I’m looking to print the list items using lambda expressions. Can anyone
help me in translating the following foreach statement using Lambda expressions ?
foreach(KeyValuePair<int, string> kvp in list)
{
Console.WriteLine(kvp.Key.ToString() + " ----> " + kvp.Value.ToString());
}
Glad i was able to figure this out by myself 🙂
list: is the name of the list you want to traverse through