Linq中的延迟执行 错了多半是马虎

int fc = 0;
var color = new List<string>() { "red", "yellow", "blue" }.Where(x => { fc++; return x.StartsWith(x); }).OrderBy(x=>x);

Console.WriteLine(fc);
Console.WriteLine(color.Count());
Console.WriteLine(fc);

 

问输出内容是什么?

 

 

 

posted @ 2024-07-25 21:17  .NET每天都很酷  阅读(12)  评论(0)    收藏  举报