Link to home
Start Free TrialLog in
Avatar of zhshqzyc
zhshqzyc

asked on

find min value

HI

I have an list(array)
1  0.01
2  0.04
3  0.04
5  0.1

Open in new window

I want to find the string which has the minimum value which is 0.01(here example)
The result is
1 0.01 

Open in new window

Avatar of jdavistx
jdavistx

using System.Linq;

var values = new List<double>(){ .01, .04, .04, .1 };
Console.WriteLine(values.Min()); //.01

Open in new window

Avatar of zhshqzyc

ASKER

Please consider 1,2,3,5 etc.
1 space 0.01 is a string
Avatar of Francis Omoruto
You have two entities in each string. How is the first entity to be treated?
Should it be ignored?
No, I want to get both of them together. I think linq can do it but I am not strong on it.
It could be likely
select data 
let element = data.split(' ')[1]
where element.min()

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jdavistx
jdavistx

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Does it return "0.01" or "1 0.01"?
I want the later.