C# Catch Exception
问题 Which exception would I use in a try/catch to find out when the user has inputted data in the wrong format? Example: try { string s = textBox1.Text; // User inputs an int // Input error MessageBox.Show(s); } catch(what exception) { MessageBox.Show("Input in wrong format"); } Thanks 回答1: Don't do this. It's a misuse of exception handling. What you are attempting to do is considered coding by exception , which is an anti-pattern. An exception is exactly what it sounds like, an exception to the