Initializes a target reference or value type with its default constructor if it has not already
been initialized.
Namespace:
System.Threading
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Shared Function EnsureInitialized(Of T) ( _
ByRef target As T, _
ByRef initialized As Boolean, _
ByRef syncLock As Object _
) As T |
C# |
---|
public static T EnsureInitialized<T>(
ref T target,
ref bool initialized,
ref Object syncLock
)
|
Parameters
- target
- Type:
T
%
A reference or value of type T to initialize if it
has not already been initialized.
- initialized
- Type:
System..::.Boolean
%
A reference to a boolean that determines whether the target has already
been initialized.
- syncLock
- Type:
System..::.Object
%
A reference to an object used as the mutually exclusive lock for initializing
target.
Type Parameters
- T
- The type of the reference to be initialized.
Return Value
The initialized value of type
T.
See Also