Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Lazy<T>

Provides support for lazy initialization.

See: https://msdn.microsoft.com/library/dd642331.aspx

Type parameters

  • T

    The type of object that is being lazily initialized.

Hierarchy

  • Lazy

Index

Constructors

constructor

  • new Lazy(valueFactory: function): Lazy
  • Initializes a new instance of the class that uses the supplied value factory.

    Parameters

    • valueFactory: function

      The delegate that is invoked to produce the lazily initialized value when it is needed.

        • (): T
        • Returns T

    Returns Lazy

Properties

Private value

value: T

Private valueConstructor

valueConstructor: object

Type declaration

Private valueCreated

valueCreated: boolean

Private valueError

valueError: Error

Private valueFactory

valueFactory: function

Type declaration

    • (): T
    • Returns T

Methods

Private createValue

  • createValue(): T

getValue

  • getValue(): T
  • Gets the lazily initialized value of the current Lazy instance.

    Returns T

    The lazily initialized value of the current instance.

isValueCreated

  • isValueCreated(): boolean
  • Gets a value that indicates whether a value has been created for this Lazy instance.

    Returns boolean

    true if a value has been created for this instance; otherwise, false.

Private lazyInitValue

  • lazyInitValue(): T

Static fromConstructor

  • fromConstructor<TStatic>(valueConstructor: object): Lazy<TStatic>
  • Returns a new instance of the class that uses the specified constructor to create a value of its type.

    Type parameters

    • TStatic

      The type of object that is being lazily initialized.

    Parameters

    • valueConstructor: object

      The parameterless constructor that is invoked to produce the lazily initialized value when it is needed.

    Returns Lazy<TStatic>

Generated using TypeDoc