Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
4
Reply
How to return dictionary with minimum value at element(0)
T K
Jun 22 2015 5:46 AM
502
Reply
In the below example, how to return row have minimum value at element(0) of dictionary?
Dictionary<int, List<string>> dictSource2 = new Dictionary<int, List<string>>
{
{ 1, new List<string> { "5", "Programmers" }},
{ 2, new List<string> { "12", "Testers" }},
{ 3, new List<string> { "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?
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
4
)
Next Recommended Forum
Compare sub strings in a List of strings
LINQ QUERY