Table of Contents

Class AdvancedLazy<T>

Namespace
Garyon.Objects.Advanced
Assembly
Garyon.dll

Provides a mechanism for a lazily initializable value.

public sealed class AdvancedLazy<T>

Type Parameters

T

The type of the lazily initializable value.

Inheritance
AdvancedLazy<T>
Inherited Members
Extension Methods

Constructors

AdvancedLazy(Func<T>)

Initializes a new instance of the AdvancedLazy<T> class from a factory method.

public AdvancedLazy(Func<T> factory)

Parameters

factory Func<T>

The factory method that will be used to lazily initialize the value.

AdvancedLazy(T)

Initializes a new instance of the AdvancedLazy<T> class from a given value.

public AdvancedLazy(T value)

Parameters

value T

The value to initialize this instance with.

Properties

IsValueCreated

Determines whether the value has been created or not.

public bool IsValueCreated { get; }

Property Value

bool

ValueOrDefault

Gets the lazily initialized value or default if it is not initialized yet.

public T? ValueOrDefault { get; }

Property Value

T

Methods

ClearValue()

Clears the cached value. Upon the next call of the GetValue() method, the value will be lazily initialized again.

public void ClearValue()

GetValue()

Gets the lazily initializable value. If the value has not been initialized yet, this property activates its initialization.

public T GetValue()

Returns

T