protected virtual void Dispose(bool disposing) { if (_disposed) { return; } if (disposing) { if (_t != null) { _t.Release(); _t = null; } } _disposed = true; }
/// <summary> /// Create a SharedRef from a previous SharedRef, incrementing the reference count. /// </summary> /// <param name="o"></param> public SharedRef(SharedRef <T> o) { o._t.Retain(); _t = o._t; }
/// <summary> /// Create a SharedRef directly from an object. Only use this once per object. /// After that, create SharedRefs from previous SharedRefs. /// </summary> /// <param name="t"></param> public SharedRef(T t) { _t = new SharedRefCounter <T>(t); _t.Retain(); }