Lazy<T, TMetadata> Class

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Provides an extension of the Lazy<T> class with support for metadata.

Inheritance Hierarchy

System.Object
  System.Lazy<T>
    System.Lazy<T, TMetadata>

Namespace:  System
Assembly:  System.ComponentModel.Composition (in System.ComponentModel.Composition.dll)

Syntax

'Declaration
Public Class Lazy(Of T, TMetadata) _
    Inherits Lazy(Of T)
public class Lazy<T, TMetadata> : Lazy<T>

Type Parameters

  • T
    Specifies the type of object that is being lazily initialized.
  • TMetadata
    Specifies the type of metadata for the object being lazily initialized.

The Lazy<T, TMetadata> type exposes the following members.

Constructors

  Name Description
Public method Lazy<T, TMetadata>(TMetadata) Initializes a new instance of the Lazy<T, TMetadata> class with the specified metadata.
Public method Lazy<T, TMetadata>(TMetadata, Boolean) Initializes a new instance of the Lazy<T, TMetadata> class with the specified metadata and thread safety mode.
Public method Lazy<T, TMetadata>(TMetadata, LazyThreadSafetyMode) Initializes a new instance of the Lazy<T, TMetadata> class with the specified metadata and thread safety mode.
Public method Lazy<T, TMetadata>(Func<T>, TMetadata) Initializes a new instance of the Lazy<T, TMetadata> class with the specified metadata and factory for the referenced value.
Public method Lazy<T, TMetadata>(Func<T>, TMetadata, Boolean) Initializes a new instance of the Lazy<T, TMetadata> class with the specified metadata, factory for the referenced value, and thread safety mode.
Public method Lazy<T, TMetadata>(Func<T>, TMetadata, LazyThreadSafetyMode) Initializes a new instance of the Lazy<T, TMetadata> class with the specified metadata, factory for the referenced value, and thread safety mode.

Top

Properties

  Name Description
Public property IsValueCreated Gets a value that indicates whether a value has been created for this Lazy<T> instance. (Inherited from Lazy<T>.)
Public property Metadata Gets or sets the metadata associated with the referenced value.
Public property Value Gets the lazily initialized value of the current Lazy<T> instance. (Inherited from Lazy<T>.)

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Creates and returns a string representation of the Lazy<T>.Value property for this instance. (Inherited from Lazy<T>.)

Top

Remarks

For more information about lazy initialization, see Lazy<T>.

Version Information

Silverlight

Supported in: 5, 4

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference