我们总是需要在我们的代码中尝试catch,它变得很丑publicvoidfoo(){try{DoSomething();}catch(Exceptione){//dowhateverwithe}}publicintFooReturnInt(){try{returnIntAfterSomeCalculation();}catch(Exceptione){//doexactlywhateverwitheasfoo()}}假设我们有一个巨大的类,其中包含许多这样的公共(public)函数,我们必须在每个函数中应用相同的trycatch。理想情况下,因为trycatch部分是相同的,我们可以将