Search code examples
c#visual-studio-2010f#conditional-breakpoint

Using tuples in conditional breakpoints in Visual Studio 2010


Will this be possible? In F# or C#? Both?

For example, I would like to set a conditional breakpoint in a F# program like that:

[x] Condition:

    myTuple == (3,3)

(o) Is true
(_) Has changed

Thanks.


Solution

  • This condition

    System.Tuple.Create(3,3).Equals(myTuple)
    

    seems to work for me.

    (Note that F# uses the C# expression evaluator in the debugger, which means breakpoint conditions, immediate window, etc, must use C# syntax, not F# syntax, when debugging F# code. In this instance, however, the same code above is correct in both F# and C#.)