Throwing nested Exceptions from a catch block…is this wise?
问题 I want to implement custom exception handling in my library so that I know where an exception occurred, so I am doing this: try { DoSomething(); } catch(Exception ex) { //LibraryException refers to any exception in the libraries exception hierarchy throw new LibraryException(ex.Message, ex); } Should this be avoided? Does it have any performance implications? What are the implications of catching, nesting and re-throwing exceptions? 回答1: The only potential problem is that you're catching a