Throwing exceptions in switch statements when no specified case can be handled

后端 未结 9 1647
你的背包
你的背包 2021-01-30 15:52

Let\'s say we have a function that changes a password for a user in a system in an MVC app.:

public JsonResult ChangePassword
    (string username, string curren         


        
9条回答
  •  没有蜡笔的小新
    2021-01-30 16:40

    With what you have it is fine although the break statement after it will never be hit because execution of that thread will cease when an exception is thrown and unhandled.

提交回复
热议问题