Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a dependent garbage-collection handle. The handle will conditionally keep a dependent object instance alive as long as a target object instance is alive as well, without representing a strong reference to the target instance.
public value class DependentHandle : IDisposable
public struct DependentHandle : IDisposable
type DependentHandle = struct interface IDisposable
Public Structure DependentHandle Implements IDisposable
A DependentHandle value with a given object instance as target will not cause the target to be kept alive if there are no other strong references to it, but it will do so for the dependent object instance as long as the target is alive.
Using this type is conceptually equivalent to having a weak reference to a given target object instance A, with that object having a field or property (or some other strong reference) to a dependent object instance B.
Initializes a new instance of the DependentHandle struct with the specified arguments.
Gets or sets the dependent object instance for the current handle.
Gets a value indicating whether this instance was constructed with DependentHandle(Object, Object) and has not yet been disposed.
Gets or sets the target object instance for the current handle. The target can only be set to a
Gets the values of both Target and Dependent (if available) as an atomic operation.
That is, even if Target is concurrently set to
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.