TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
T K
NA
31
6.3k
How to return dictionary with minimum value at element(0)
Jun 22 2015 5:46 AM
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?
Reply
Answers (
4
)
Compare sub strings in a List of strings
LINQ QUERY