C# - 在调试模式下单步执行时跳过方法的属性

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/445276/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 03:38:51  来源:igfitidea点击:

C# - Attribute to Skip over a Method while Stepping in Debug Mode

c#.netdebuggingattributes

提问by BuddyJoe

Is there an attribute I can use on a method so that when stepping through some code in Debug mode the Debugger stays on the outside of the method?

是否有我可以在方法上使用的属性,以便在调试模式下单步执行某些代码时,调试器停留在方法的外部?

采纳答案by Andrew Rollings

 [DebuggerStepThrough]

(docs)

文档

回答by Ben

Not forgetting to add:

别忘了补充:

using System.Diagnostics;

回答by BaSsGaz

It's written <DebuggerStepThrough>in VB.NET.

它是用VB.NET编写<DebuggerStepThrough>的。

To use it just put on top of the method like :

要使用它,只需将其放在方法之上,例如:

<DebuggerStepThrough>
Private Sub form_Paint(sender As Object, e As PaintEventArgs) Handles form.Paint
     ' Picasso
End Sub