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

后端 未结 9 1655
你的背包
你的背包 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:37

    I never add a break after a throw statement contained in a switch statement. Not the least of the concerns is the annoying "unreachable code detected" warning. So yes, it is a good idea.

提交回复
热议问题