Table of Contents

Class LazyVariable<TValue>

Namespace
AsmResolver
Assembly
AsmResolver.dll

Represents a variable that can be lazily initialized and/or assigned a new value.

public sealed class LazyVariable<TValue>

Type Parameters

TValue

The type of the values that the variable stores.

Inheritance
LazyVariable<TValue>
Inherited Members

Remarks

For performance reasons, this class locks on itself for thread synchronization. Therefore, consumers should not lock instances of this class as a lock object to avoid dead-locks.

Constructors

LazyVariable(Func<TValue?>)

Creates a new lazy variable and delays the initialization of the default value.

public LazyVariable(Func<TValue?> getValue)

Parameters

getValue Func<TValue>

The method to execute when initializing the default value.

LazyVariable(TValue)

Creates a new lazy variable and initialize it with a constant.

public LazyVariable(TValue value)

Parameters

value TValue

The value to initialize the variable with.

Properties

IsInitialized

Gets a value indicating the value has been initialized.

public bool IsInitialized { get; }

Property Value

bool

Value

Gets or sets the value of the variable.

public TValue Value { get; set; }

Property Value

TValue