TLazyInitializer.EnsureInitialized<T>(T) Method

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

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

Type Parameters



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.