On Monday 05 April 2004 13:59, Charles Comstock wrote: > there is no comparable operation in java, without explictely > declaring a wrapping try / catch / finally. $ cat Main.java public class Main { public static void main(String[] s) { new WithCriticalResource() { public void action() { System.out.print("code executed"); } }.run(); new WithCriticalResource() { public void action() { throw new RuntimeException("let someone else mop this up"); } }.run(); } } abstract class WithCriticalResource { public final void run() { try { // set up critical resource System.out.print("resource opened, "); action(); } finally { System.out.println(", resource closed."); } } protected abstract void action(); } $ java -cp . Main resource opened, code executed, resource closed. resource opened, , resource closed. Exception in thread "main" java.lang.RuntimeException: let someone else mop this up at Main$2.action(Main.java:12) at WithCriticalResource.run(Main.java:25) at Main.main(Main.java:10) You can do the same thing in C# 1.0.