a question about exception in c#
问题 following is a code snippet: class xxx { public xxx(){} try { throw new Exception(InvalidoperationException); } catch(Exception x) { } catch(InvalidoperationException x) { } } can anyone tell which exception will raise here and what is the reason behind it. 回答1: Wow, lots of problems here. Where to start? That code won't compile. The try-catch block that you've defined is outside of any method, which is not allowed. You need to move it inside of a method. Never throw a method that you intend