Partager via


PhantomReference Constructors

Definition

Overloads

PhantomReference(Object, ReferenceQueue)

Creates a new phantom reference that refers to the given object and is registered with the given queue.

PhantomReference(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

PhantomReference(Object, ReferenceQueue)

Creates a new phantom reference that refers to the given object and is registered with the given queue.

[Android.Runtime.Register(".ctor", "(Ljava/lang/Object;Ljava/lang/ref/ReferenceQueue;)V", "")]
public PhantomReference (Java.Lang.Object? referent, Java.Lang.Ref.ReferenceQueue? q);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/Object;Ljava/lang/ref/ReferenceQueue;)V", "")>]
new Java.Lang.Ref.PhantomReference : Java.Lang.Object * Java.Lang.Ref.ReferenceQueue -> Java.Lang.Ref.PhantomReference

Parameters

referent
Object

the object the new phantom reference will refer to

q
ReferenceQueue

the queue with which the reference is to be registered, or null if registration is not required

Attributes

Remarks

Creates a new phantom reference that refers to the given object and is registered with the given queue.

It is possible to create a phantom reference with a null queue, but such a reference is completely useless: Its get method will always return null and, since it does not have a queue, it will never be enqueued.

Java documentation for java.lang.ref.PhantomReference.PhantomReference(T, java.lang.ref.ReferenceQueue<? super T>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

PhantomReference(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected PhantomReference (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Java.Lang.Ref.PhantomReference : nativeint * Android.Runtime.JniHandleOwnership -> Java.Lang.Ref.PhantomReference

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to