TLazyInitializer Record

Definition

Provides lazy initialization routines.

Delphi
type TLazyInitializer = record

Remarks

The methods are using AtomicCmpExchange to ensure thread-safety when initializing instances.

Methods

EnsureInitialized<T>(T)

Initializes a target reference type by using a specified function if it hasn't already been initialized.

EnsureInitialized<T>(T, Func<T>)

Initializes a target reference type by using a specified function if it hasn't already been initialized.