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.

Edited by ddanbe: Update

1 Year
Discussion Span
Last Post by ddanbe

The 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.

Votes + Comments

To clarify the NegativeInfinity issue a bit. I harvested(scrape is such an ugly word) a table from a website. One column (which I'm interested in) had some real strings and some empty cells. I changed the empty cells to NaN. So no NegativeInfinity issue here. I'd just like to do some statistics on my list. Don't no if this is the right way to go, perhaps I better remove the NaN cells...

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.