Lazy<T> Record

Definition

Provides support for lazy initialization.

Delphi
type Lazy<T> = record

Type Parameters

T

The type of object that is being lazily initialized.

Constructors

Create(Func<T>, Boolean)

Initializes a new instance of the Lazy<T> record. When lazy initialization occurs, the specified initialization function is used.

CreateFrom(T, Boolean)

Initializes a new instance of Lazy<T> with the specified value.

Properties

IsAssigned

Returns true if the value is assigned and contains an ILazy<T> reference; otherwise returns false.

IsValueCreated

Gets a value that indicates whether a value has been created for this Lazy<T> instance.

Value

Gets the lazily initialized value of the current Lazy<T> instance.

Methods

Create

Initializes a new instance of the Lazy<T> record. When lazy initialization occurs, the default constructor of the target type is used.

Operators