Class Scope<TScope, TInstance>
Scopes a type instance.
public class Scope<TScope, TInstance> : IDisposable
Type Parameters
TScopeThe type of the scope.
TInstanceThe type of the instance.
- Inheritance
-
Scope<TScope, TInstance>
- Implements
- Inherited Members
Constructors
Scope(TInstance)
Initializes a new instance of the Scope<T> class.
public Scope(TInstance instance)
Parameters
instanceTInstanceThe instance.
Scope(TInstance, bool)
Initializes a new instance of the Scope<T> class.
public Scope(TInstance instance, bool toDispose)
Parameters
instanceTInstanceThe 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<TScope, TInstance>? Ambient { get; }
Property Value
- Scope<TScope, TInstance>
Current
Gets the current instance of T in the ambient scope.
public static TInstance? Current { get; set; }
Property Value
- TInstance
The current instance of T.
ParentValue
Gets the value held by the enclosing scope, or the default value of TInstance when this scope has no parent.
protected TInstance? ParentValue { get; }
Property Value
- TInstance
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()