I'd like to create an attribute that I can use to wrap a method in a try..finally. I don't know if this is possible, but any ideas would be appreciated. Basically I'd like to be able to do the following:
[TryFinally]
public void MyMethod() {
dostuff;
}
And the code of the method would be wrapped in a try..finally without actually having to add the try..finally in the method.
[TryFinally]
public void MyMethod() {
dostuff;
}
And the code of the method would be wrapped in a try..finally without actually having to add the try..finally in the method.