Android Guides | Samples

Java.Lang.IAutoCloseable

Defines an interface for classes that can (or need to) be closed once they are not used any longer.

See Also: IAutoCloseable

Syntax

[Android.Runtime.Register("java/lang/AutoCloseable", "", "Java.Lang.IAutoCloseableInvoker")]
public interface IAutoCloseable : IJavaObject, IDisposable

Remarks

Defines an interface for classes that can (or need to) be closed once they are not used any longer. Calling the close method releases resources that the object holds.

A common pattern for using an AutoCloseable resource:

java Example

Closable foo = new Foo();
   try {
      ...;
    finally {
      foo.close();
   }
 }

[Android Documentation]

Requirements

Namespace: Java.Lang
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0

The members of Java.Lang.IAutoCloseable are listed below.

Public Methods

Close()
Closes the object and release any system resources it holds.