我发现了一些很奇怪的东西(我想!)。如果我尝试在 yes() 方法中放置断点,它在执行函数时将永远不会暂停程序。如果我尝试对任何其他代码行执行相同的操作,它将按预期工作。这是一个错误,还是有什么东西在逃避我?
过滤器将返回 2 个对象,除调试器外,一切似乎都按预期工作。
private void Form1_Load(object sender, EventArgs e) {
    List<LOL> list = new List<LOL>();
    list.Add(new LOL());
    list.Add(new LOL());
    IEnumerable<LOL> filter = list.Where(
        delegate(LOL lol) {
            return lol.yes();
        }
    );
    string l = "";   <------this is hit by the debugger
}
class LOL {
    public bool yes() {
        bool ret = true; <---------this is NOT hit by the debugger
        return ret;
    }
}