すべてのメソッドに「try...catch」と書くのではなく、属性を使用して例外処理を行うことは可能ではないかと考えていました。
たとえば、各メソッドは次のようになります。
public void DoSomething()
{
try
{
// do something
}
catch (Exception ex)
{
// exception handling rules, always the same.
throw;
}
}
私が欲しい:
[HandleException]
public void DoSomething()
{
// do something
}
出来ますか?