You are hereVisual Studio 2010 Conditional Breakpoints with Strings

Visual Studio 2010 Conditional Breakpoints with Strings

By hagrin - Posted on 24 December 2011

Here's a really simple tip that isn't exactly readily obvious to novice .Net programmers. You can check out my post on conditional breakpoints in Visual Studio 2005 for a more in-depth explanation as to what a conditional breakpoint is and why you would want to set one.

However, something I didn't cover was "what if I want to have a conditional breakpoint when a string variable is a certain value?". Seems simple enough but if you try something like strVariable = "something" or strVariable == "something", neither will work. So exactly how do you evaluate a string in a conditional breakpoint?

Simply do strVariable.Equals("something"). Intellisense even works!

Happy debugging!