Edit

Share via


WeakGCHandle<T>.TryGetTarget(T) Method

Definition

Tries to retrieve the target object that is referenced by the current WeakGCHandle<T> object.

public:
 bool TryGetTarget([Runtime::InteropServices::Out] T % target);
public readonly bool TryGetTarget(out T? target);
member this.TryGetTarget : 'T -> bool
Public Function TryGetTarget (ByRef target As T) As Boolean

Parameters

target
T

When this method returns, contains the target object, if it is available.

Returns

true if the target was retrieved; otherwise, false.

Exceptions

The handle is not initialized or is already disposed.

Applies to