Share via


IJavaPeerable.Finalized Method

Definition

Called when the instance has been finalized.

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

Remarks

The Finalized method is invoked after the finalizer has been invoked on the instance. The PeerReference property is NOT valid when Finalized is invoked.

<block subset="none" type="usage"> This method should only be invoked by the JniRuntime instance which will be managing the IJavaPeerable value. </block> <block subset="none" type="overrides">

If the type is following the typical IDisposable pattern, then the Finalized method should delegate to the Dispose(bool) method. The proscribed implementation template is:

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

	~ExampleBinding ()
	{
        JniEnvironment.Runtime.ValueManager.TryCollectObject (this);
	}

	protected virtual void Dispose (bool disposing)
	{
	}

	void IJavaPeerable.Finalized ()
	{
	    Dispose (disposing: false);
	}
}

</block>

Applies to

See also