How to go through the whole block of code?

I would like to skip some parts of my code when I set breakpoints. For example, I have a block of code that is repeated 52 times to create a deck of cards. This works correctly, and I would rather not hit F11 to keep going through this block. Is there anyway for me to “skip” this so that the debugger simply proceeds to the next method call?

The language and IDE are C # in VS 2008.

+3
source share
4 answers

If this is an option, you can transfer this code to a function and apply the [DebuggerStepThrough] attribute to this function so that it is always skipped during debugging

Same:

using System.Diagnostics;

namespace MyNamespace
{
    public class Utilities
    {
        [DebuggerStepThrough]
        public ThisIsAVeryLongMethod()
        {
            //
            // Code
            //
        }
    }
}

, ,

ShortMethod1();
ThisIsAVeryLongMethod();
ShortMethod2();
+2

  • "Run to Cursor"

, , F5, .

. , , , . , , , .

+5

, , F5:)

+5

I don't know how to skip a block, but you can put a breakpoint after the block or use run-to-cursor (ctrl-F10, I think).

+2
source

Source: https://habr.com/ru/post/1716554/


All Articles