How to throw silence in C #?

I have a property related to ComboBox

    <ComboBox ItemsSource="{Binding AvailableTypes}"
            SelectedValue="{Binding Kind, Mode=TwoWay}}"/>

and in the property adjuster, I make an exception in some business circumstances to interrupt the property setting.

    public MyKind Kind
    {
        get { return kind; }
        set 
        {
            if (kind != value)
            {
                if (SomeRuleFailed(value))
                throw new Exception("to be ate by binding code");
                kind = value;
            }
        }
    }

It runs smoothly, except that VS2010 appears every time I throw an exception. Is there any exception for a raise or attribute to set so that the debugger stays in the background?

+3
source share
3 answers

You should not throw an instance of the class Exception. You must throw an instance of the class derived from Exception.

( , -, ), , Visual Studio.

, Debug → Exceptions... , .

+5

, , a > . .

+5

Press Ctrl-Alt-E in Visual Studio to open the exception configuration for the debugger, and select or deselect what you need.

+3
source

All Articles