The Java 7 'try with resources' statement is a shortcut for a try/finally block which closes an object of type java.io.Closeable. The C# equivalent is the 'using' statement, which operates on objects of type System.IDisposable:
|try (Foo f = new Foo())
|using (Foo f = new Foo())
Use Java to C# Converter to convert from Java to C#.
Java and C# Equivalents
Copyright © 1997 – 2018 Tangible Software Solutions, Inc.