gpt4 book ai didi

c# - 如何在 step-into(F11) 中跳过方法

转载 作者:太空狗 更新时间:2023-10-30 00:52:05 26 4
gpt4 key购买 nike

让我们举个例子:

public static class Extensions
{
public static string MakeString(this object obj)
{
if (obj == null) return string.Empty;

return obj.ToString();
}
}

public class ABC
{
public void Method()
{
object obj = default(object);

//Implemention goes here..

// Here every time in step into navigate to MakeString() Method.
if(IsValid(obj.MakeString()))
{
//Operations..
}
}

private bool IsValid(string str)
{
//Check if string is valid or not..
return true;
}
}

在此示例中,Extentions 类具有扩展方法,并在类 ABC 中使用它,并且当进入此扩展和其他方法调用的条件时,每次我进入MakeString() 方法,我们可以跳过吗?通过使用方法属性?还是通过其他方式?

最佳答案

您可以使用 DebuggerStepThrough对此的属性。

关于c# - 如何在 step-into(F11) 中跳过方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23492763/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com