LJNielsenDk
LJNielsenDk

Reputation: 1460

Set breakpoint on specific value of watched variable

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.

Upvotes: 0

Views: 91

Answers (1)

har07
har07

Reputation: 89285

Try this:

if(System.Diagnostics.Debugger.IsAttached && yourVariable == specificValue)
  System.Diagnostics.Debugger.Break();

Upvotes: 3

Related Questions