AsyncLocal<T> Constructors

Definition

Instantiates an AsyncLocal<T> instance.

Overloads

AsyncLocal<T>()

Instantiates an AsyncLocal<T> instance that does not receive change notifications.

AsyncLocal<T>(Action<AsyncLocalValueChangedArgs<T>>)

Instantiates an AsyncLocal<T> local instance that receives change notifications.

AsyncLocal<T>()

Source:
AsyncLocal.cs
Source:
AsyncLocal.cs
Source:
AsyncLocal.cs

Instantiates an AsyncLocal<T> instance that does not receive change notifications.

C#
public AsyncLocal();

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0

AsyncLocal<T>(Action<AsyncLocalValueChangedArgs<T>>)

Source:
AsyncLocal.cs
Source:
AsyncLocal.cs
Source:
AsyncLocal.cs

Instantiates an AsyncLocal<T> local instance that receives change notifications.

C#
[System.Security.SecurityCritical]
public AsyncLocal(Action<System.Threading.AsyncLocalValueChangedArgs<T>> valueChangedHandler);
C#
public AsyncLocal(Action<System.Threading.AsyncLocalValueChangedArgs<T>>? valueChangedHandler);
C#
public AsyncLocal(Action<System.Threading.AsyncLocalValueChangedArgs<T>> valueChangedHandler);

Parameters

valueChangedHandler
Action<AsyncLocalValueChangedArgs<T>>

The delegate that is called whenever the current value changes on any thread.

Attributes

Remarks

The delegate's signature is Action<AsyncLocalValueChangedArgs<T>>.

See also

Applies to

.NET 10 and other versions
Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 1.3, 1.4, 1.6, 2.0, 2.1
UWP 10.0