The select method ought to work if you are using .NET 3.5 or newer:
List<double> result = l.Select(x => double.Parse(x)).ToList();
Here is some example code:
List<string> l = new List<string> { (0.1).ToString(), (1.5).ToString() };
List<double> result = l.Select(x => double.Parse(x)).ToList();
foreach (double x in result)
{
Console.WriteLine(x);
}
Result:
0,1
1,5
One thing to be aware of is which culture you are using to parse the strings. You might want to use the Parse
overload that takes a culture and use CultureInfo.InvariantCulture
for example.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…