Class RefTrackedObject
- Namespace
- PaintDotNet.ComponentModel
- Assembly
- PaintDotNet.ComponentModel.dll
Provides a base implementation for a managed IObjectRef that tracks its references.
public class RefTrackedObject : IObjectRef, IIsDisposed, IDisposable, ISerializable
- Inheritance
-
RefTrackedObject
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
References are divided into two categories: primary, and secondary. Secondary references are those which are retrieved via TryCreateRef. The primary reference is the object instance itself. Calling Dispose() will only decrement the reference count the first time it's called. Both reference types are counted in the 'refCount' field, and are treated equally when deciding when to finally execute the inner Dispose() method.
Constructors
Properties
Methods
- TryCreateRef(Type, out IObjectRef?)
Checks to see if the given interface is supported by this object, and if so creates that wrapper and provides it to you. This adds 1 to the reference count of the underlying object. To decrement the reference count, dispose the wrapper provided by this method or permit it to be garbage collected. When the reference count reaches 0, the object will be disposed.