I have a List<double> MyList
something looking like this: 4.75/1.01/5.66/NaN/42.42/3.33
I’d like to get the minimum value of 1.01 out of it, but I get d = NaN when doing double d = MyList.Min();
Tried, after some long internet strolls, something with LINQ to no avail.
Some LINQ afictionados around here, who can help me out?
As always, my gratitude will be immense.
ddanbe
2,724
Professional Procrastinator
Featured Poster
Recommended Answers
Jump to PostThe first thing that comes to mind is to filter out the special value(s):
MyList.Where(x => !double.IsNaN(x)).Min()
.Though depending on what might be acceptable insertions into the list, you might need to consider things like NegativeInfinity as well.
All 3 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
ddanbe
commented:
kudos!
+15
ddanbe
2,724
Professional Procrastinator
Featured Poster
ddanbe
2,724
Professional Procrastinator
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.