Share via


IJavaPeerable.DisposeUnlessReferenced Method

Definition

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

public void DisposeUnlessReferenced ();
abstract member DisposeUnlessReferenced : unit -> unit

Remarks

Call this method when you would like to allow instances to be collectable as soon as possible, but not if the current instance is referenced anywhere else.

[JniTypeSignature ("my/Example")]
partial class ExampleBinding : IJavaPeerable {

	public void DisposeUnlessReferenced ()
	{
        JniEnvironment.Runtime.ValueManager.DisposeUnlessReferenced (this);
	}
}

Applies to

See also