ThreadLocal(T) Constructor (Func(T))

Task Parallel System.Threading

Initializes the ThreadLocal<(Of <(T>)>) instance with the specified valueFactory function.

Namespace:  System.Threading
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Sub New ( _
	valueFactory As Func(Of T) _
)
C#
public ThreadLocal(
	Func<T> valueFactory
)

Parameters

valueFactory
Type: System..::.Func<(Of <(T>)>)
The Func<(Of <(T>)>) invoked to produce a lazily-initialized value when an attempt is made to retrieve Value without it having been previously initialized.

Exceptions

ExceptionCondition
System..::.ArgumentNullException valueFactory is a null reference (Nothing in Visual Basic).

See Also