In the below example, how to return row have minimum value at element(0) of dictionary?
Dictionary> dictSource2 = new Dictionary>
{
{ 1, new List { "5", "Programmers" }},
{ 2, new List { "12", "Testers" }},
{ 3, new List { "2", "Designers" }},
};
I want to return the following data from above dictionary-
"2", "Designers"
I have written below:
string sminValue= dictSource.Min(pair => pair.Value.ElementAt(0))
But it returns the incorrect results.Note, my solution woks fine when value at ElementAt(0) has zero records. Can anyone guide here?
Sakthikumar ThanavelPosted Jun 24, 2015, 3:03 PM
{ 1, new List<string> { "5", "Programmers" }},{ 2, new List<string> { "12", "Testers" }},{ 3, new List<string> { "2", "Designers" }}, };{Jaipal ReddyPosted Jun 22, 2015, 6:36 AM
Jaipal ReddyPosted Jun 22, 2015, 6:21 AM
Jaipal ReddyPosted Jun 22, 2015, 6:19 AM
min(d.items(), key=lambda x: x[1])[0]