Esempio n. 1
0
 /// <summary>
 /// Initializes a new Scoped value.
 /// </summary>
 /// <param name="value">The value to scope.</param>
 public Scoped(T value)
 {
     this.refCount = new ReferenceCount <T>(value);
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes a new instance of the Lifetime class.
 /// </summary>
 /// <param name="value">The value to keep alive.</param>
 /// <param name="onDisposeAction">The action to perform when the lifetime is terminated.</param>
 public Lifetime(ReferenceCount <T> value, Action onDisposeAction)
 {
     this.refCount        = value;
     this.onDisposeAction = onDisposeAction;
 }
 ///<inheritdoc/>
 public bool Equals(ReferenceCount <TValue> other)
 {
     return(other != null &&
            EqualityComparer <TValue> .Default.Equals(value, other.value) &&
            count == other.count);
 }