Table of Contents

Class Scope<T>

Namespace
Arc4u.Threading
Assembly
Arc4u.Threading.dll

Scopes a type instance.

public class Scope<T> : IDisposable

Type Parameters

T

Any type.

Inheritance
Scope<T>
Implements
Inherited Members

Constructors

Scope(T)

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

public Scope(T instance)

Parameters

instance T

The instance.

Scope(T, bool)

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

public Scope(T instance, bool toDispose)

Parameters

instance T

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<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

disposing bool

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.