Do I have to break after throwing exception?

前端 未结 6 1656
予麋鹿
予麋鹿 2021-01-03 20:58

I\'m writing a custom class in C# and I\'m throwing a couple exceptions if people give the wrong inputs in some of the methods. If the exception is thrown, will any of the c

6条回答
  •  时光说笑
    2021-01-03 21:04

    As an aside to your actual question: you might want to rethink using exceptions to provide validation info back to the user.

    Raising exceptions is expensive resource-wise and slow. If you have a number of validation rules that you need to apply then write specific code for these - you should probably only rely on exception handling for things you don't anticipate.

提交回复
热议问题