Provides lazy initialization routines.
More...
|
static T | EnsureInitialized< T > (ref T target) |
| Initializes a target reference type with the type's default constructor if it hasn't already been initialized. More...
|
|
static T | EnsureInitialized< T > (ref T target, Func< T > valueFactory) |
| Initializes a target reference type by using a specified function if it hasn't already been initialized. More...
|
|
static T | EnsureInitialized< T > (ref T target, ref bool initialized, ref object syncLock) |
| Initializes a target reference or value type with its default constructor if it hasn't already been initialized. More...
|
|
static T | EnsureInitialized< T > (ref T target, ref bool initialized, ref object syncLock, Func< T > valueFactory) |
| Initializes a target reference or value type by using a specified function if it hasn't already been initialized. More...
|
|
Provides lazy initialization routines.
Definition at line 8 of file LazyInitializer.cs.
◆ EnsureInitialized< T >() [1/4]
static T System.Threading.LazyInitializer.EnsureInitialized< T > |
( |
ref T |
target | ) |
|
|
static |
Initializes a target reference type with the type's default constructor if it hasn't already been initialized.
- Parameters
-
target | A reference of type T to initialize if it has not already been initialized. |
- Template Parameters
-
T | The type of the reference to be initialized. |
- Returns
- The initialized reference of type T .
- Exceptions
-
T:System.MemberAccessException | Permissions to access the constructor of type T were missing. |
T:System.MissingMemberException | Type T does not have a default constructor. |
Definition at line 17 of file LazyInitializer.cs.
◆ EnsureInitialized< T >() [2/4]
static T System.Threading.LazyInitializer.EnsureInitialized< T > |
( |
ref T |
target, |
|
|
Func< T > |
valueFactory |
|
) |
| |
|
static |
Initializes a target reference type by using a specified function if it hasn't already been initialized.
- Parameters
-
target | The reference of type T to initialize if it hasn't already been initialized. |
valueFactory | The function that is called to initialize the reference. |
- Template Parameters
-
T | The reference type of the reference to be initialized. |
- Returns
- The initialized value of type T .
- Exceptions
-
T:System.MissingMemberException | Type T does not have a default constructor. |
T:System.InvalidOperationException | valueFactory returned null (Nothing in Visual Basic). |
Definition at line 35 of file LazyInitializer.cs.
◆ EnsureInitialized< T >() [3/4]
static T System.Threading.LazyInitializer.EnsureInitialized< T > |
( |
ref T |
target, |
|
|
ref bool |
initialized, |
|
|
ref object |
syncLock |
|
) |
| |
|
static |
Initializes a target reference or value type with its default constructor if it hasn't already been initialized.
- Parameters
-
target | A reference or value of type T to initialize if it hasn't already been initialized. |
initialized | A reference to a Boolean value that determines whether the target has already been initialized. |
syncLock | A reference to an object used as the mutually exclusive lock for initializing target . If syncLock is null , a new object will be instantiated. |
- Template Parameters
-
T | The type of the reference to be initialized. |
- Returns
- The initialized value of type T .
- Exceptions
-
T:System.MemberAccessException | Permissions to access the constructor of type T were missing. |
T:System.MissingMemberException | Type T does not have a default constructor. |
Definition at line 64 of file LazyInitializer.cs.
◆ EnsureInitialized< T >() [4/4]
static T System.Threading.LazyInitializer.EnsureInitialized< T > |
( |
ref T |
target, |
|
|
ref bool |
initialized, |
|
|
ref object |
syncLock, |
|
|
Func< T > |
valueFactory |
|
) |
| |
|
static |
Initializes a target reference or value type by using a specified function if it hasn't already been initialized.
- Parameters
-
target | A reference or value of type T to initialize if it hasn't already been initialized. |
initialized | A reference to a Boolean value that determines whether the target has already been initialized. |
syncLock | A reference to an object used as the mutually exclusive lock for initializing target . If syncLock is null , a new object will be instantiated. |
valueFactory | The function that is called to initialize the reference or value. |
- Template Parameters
-
T | The type of the reference to be initialized. |
- Returns
- The initialized value of type T .
- Exceptions
-
T:System.MemberAccessException | Permissions to access the constructor of type T were missing. |
T:System.MissingMemberException | Type T does not have a default constructor. |
Definition at line 83 of file LazyInitializer.cs.
The documentation for this class was generated from the following file: