Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Dears,
I want to know if I can break the execution at some particular values of variables.
I am using C#.net
thank you
Posted

Depending on the version/edition of Visual Studio you have, you can use conditional breakpoints.

If you don't have the correct version/edition, you can just use an if statement and put a breakpoint in that:
C#
int x = GetValue()
if(x == 5){
    // Set breakpoint on the below line.
    x = x;
}
 
Share this answer
 
The best way to do this, is make your variable a property, so you can add code to check for the value, and put a breakpoint in there. You can set breakpoints to only trigger based on a value, but they will only trigger on that breakpoint still.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900