Lazy<T>.Create Constructor
Overloads
| Create |
Initializes a new instance of the Lazy<T> record. When lazy initialization occurs, the default constructor of the target type is used. |
| Create(Func<T>, Boolean) |
Initializes a new instance of the Lazy<T> record. When lazy initialization occurs, the specified initialization function is used. |
Initializes a new instance of the Lazy<T> record. When lazy initialization occurs, the specified initialization function is used.
Delphi
constructor Create(const valueFactory: Func<T>; ownsObject: Boolean = False)
Parameters
- valueFactory
- Func<T>
The delegate that is invoked to produce the lazily initialized value when it is needed.
- ownsObject
- Boolean
If true the value - if any got created - will be destroyed when going out of scope. Only when T is a class type.
Exceptions
valueFactory is nil .