TLazyInitializer.EnsureInitialized<T>(T) Method

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

Namespace: Spring
public
 class function EnsureInitialized<T: class, constructor>(var target: T): T; overload; static;

Type Parameters

T

Parameters

target
Type: T

Return Value

Type: T

 

In the event that multiple threads access this method concurrently, multiple instances of T may be created, but only one will be stored into target. In such an occurrence, this method will destroy the instances that were not stored.