简体   繁体   中英

How to stop code when a condition is met c#, Debuging

I can't seem to find anything in C# that does this. I went through pages on MSDN but could not find anything. I know there the Threading , but I don't see how you could use this for debuging?

ie, if you do this in VBA, the code stops for you and then you can debug from that point.

Dim ID As Long

      ID = 1001

      If ID = 1001 Then Stop

Is there a function in C# that will perform the same as Stop in VBA?

Use the Debugger.Break() function.

long ID;
ID = 1001;
if(ID == 1001)
{
    Debugger.Break();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM