0

I'm sure I have seen the answer to this on here before but I can't find it.

How do I, using code, set a breakpoint on a specific variable getting a specific value?

This is not what I'm looking for, there is a way to do it in code too.

In case it is not supported in all .NET languages I'm looking for a C# answer.

Community
  • 1
  • 1
LJNielsenDk
  • 1,414
  • 1
  • 16
  • 32

1 Answers1

2

Try this:

if(System.Diagnostics.Debugger.IsAttached && yourVariable == specificValue)
  System.Diagnostics.Debugger.Break();
har07
  • 88,338
  • 12
  • 84
  • 137
  • I didnt remember the exact command too, just lucky to found it. – har07 Dec 18 '13 at 14:26
  • 1
    You might also want to look on [conditional breakpoints](http://stackoverflow.com/questions/6670415/how-to-set-conditional-breakpoints-in-visual-studio). – Jan Dec 18 '13 at 14:34