linq的小的问题
本帖最后由 xzgspchina 于 2013-02-01 14:56:25 编辑
string[] name =new string[1000];
for (int i = 0; i < 1000; i++)
{
name[i] = i.ToString();
}
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
IEnumerable<string> storName = from n in name
where (n.Length == (from n1 in name
orderby n1.Length
select n1.Length).First()
)
select n;
foreach (string s in storName)
{
Console.WriteLine(s);
}
stopwatch.Stop();
Console.WriteLine(stopwatch.Elapsed);
Console.ReadLine();