Class Scope<T>
Scopes a type instance.
public class Scope<T> : IDisposable
Type Parameters
TAny type.
- Inheritance
-
Scope<T>
- Implements
- Inherited Members
Constructors
Scope(T)
Initializes a new instance of the Scope<T> class.
public Scope(T instance)
Parameters
instanceTThe instance.
Scope(T, bool)
Initializes a new instance of the Scope<T> class.
public Scope(T instance, bool toDispose)
Parameters
instanceTThe instance.
toDisposeboolIndicates if the scoped
instanceis disposed when its scope is disposed.
Properties
Ambient
Gets the innermost active scope of the current asynchronous flow, or null when there is none.
protected static Scope<T>? Ambient { get; }
Property Value
- Scope<T>
Current
Gets the current instance of T in the ambient scope.
public static T? Current { get; set; }
Property Value
- T
The current instance of T.
ParentValue
Gets the value held by the enclosing scope, or the default value of T when this scope has no parent.
protected T? ParentValue { get; }
Property Value
- T
Methods
Dispose()
Disposes the ambient scope and its current instance when applicable.
public void Dispose()
Dispose(bool)
Disposes the ambient scope and its current instance when applicable.
protected virtual void Dispose(bool disposing)
Parameters
disposingbool
ToString()
Returns a string that represents this instance.
public override string ToString()