select不是system.array的成员
string input = "100;108;209;401;309;330;";
int result2 = input.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Select(x => Convert.ToInt32(x)).OrderBy(x=>x).ToList().Find(x => { return x >= 320; });
Console.WriteLine(result2);
private void Test()
{
double toFind = 300.0;
string input = "100;108;209;401;309;330;";
string[] splited = input.Split(
new char[] { ';' },
StringSplitOptions.RemoveEmptyEntries);
double min = double.Parse(splited[0]);
if (min != toFind)
{
foreach (string str in splited)
{
double cur = double.Parse(str);
if (cur == toFind) { min = cur; break; }
if (cur > toFind)
{
if (min < toFind) { min = cur; }
else { if (cur < min)min = cur; }
}
}
}
if (min < toFind)
{
Console.WriteLine("No value found.");
}
else
{
Console.WriteLine("value:{0}", min);
}
}