如何跳过内部带有lambda代码的函数? [英] How to skip the function with lambda code inside?

查看:139
本文介绍了如何跳过内部带有lambda代码的函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑以下片段:

    [DebuggerStepThrough]
    private A GetA(string b)
    {
        return this.aCollection.FirstOrDefault(a => a.b == b);
    }

如果我使用F11调试器,则不会跳过该函数,而是在 ab == b

If I use F11 debugger doesn't skip the function instead it stops at a.b == b.

有什么方法可以跳过此功能,而不是使用F10吗?

Is there any way to jump over this function rather than using F10?

推荐答案

我可以理解为什么会发生这种情况,但没有办法解决它。也许有人可以以此为基础。 lambda表达式被编译成匿名方法。

I can see why it happens but don't have a way to get around it. Perhaps someone can build on this. The lambda expression gets compiled into an Anonymous Method.

我看到:Program.GetA.AnonymousMethod__0(Test a)

I see: Program.GetA.AnonymousMethod__0(Test a)

就像您在显示的方法中调用另一个方法一样,按F11即可进入该方法。例如//

Just like if you called another method in the method you've shown, pressing F11 would go into that method. eg/

[DebuggerStepThrough]
static A GetA<A>(IList<A> aCollection, string b) where A : Test
{
    DoNoOp();
    return aCollection.FirstOrDefault(a => a.b == b);
}

static void DoNoOp()
{
    // noop
    Console.WriteLine("got here");
}

这篇关于如何跳过内部带有lambda代码的函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆