Table of Contents

Class Scope<TScope, TInstance>

Namespace
Arc4u.Threading
Assembly
Arc4u.Threading.dll

Scopes a type instance.

public class Scope<TScope, TInstance> : IDisposable

Type Parameters

TScope

The type of the scope.

TInstance

The 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

instance TInstance

The instance.

Scope(TInstance, bool)

Initializes a new instance of the Scope<T> class.

public Scope(TInstance instance, bool toDispose)

Parameters

instance TInstance

The instance.

toDispose bool

Indicates if the scoped instance is 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

disposing bool

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.