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
Abdalla Omran
NA
334
31.6k
How to get the MaxValue using LINQ ?!
Apr 29 2019 7:25 AM
Hi there .
i am useing the following Code trying to get the maxValue from a list but it gives me an Exception (At least one object must implement IComparable) !
I need help to get a solution and explanation why this Exception
Hide Copy Code
public static TheQFromDB GetMaxWithLINQ (List<TheQFromDB> input)
{
TheQFromDB GetItem = input.First();
foreach (var item in input)
{
var max = input.OrderByDescending(s=> s.SecondsDiff).Max();
GetItem = item;
}
return GetItem;
}
Reply
Answers (
3
)
How do i prevent stack overflows in binary search algorithm?
How can i copy data from column to another table