[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Provides support for lazy initialization.
Namespace:
System
Assembly:
mscorlib (in mscorlib.dll)
Visual Basic (Declaration)
<SerializableAttribute> _
<ComVisibleAttribute(False)> _
<HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization := True, _
ExternalThreading := True)> _
Public Class Lazy(Of T)
Dim instance As Lazy(Of T)
[SerializableAttribute]
[ComVisibleAttribute(false)]
[HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true,
ExternalThreading = true)]
public class Lazy<T>
[SerializableAttribute]
[ComVisibleAttribute(false)]
[HostProtectionAttribute(SecurityAction::LinkDemand, Synchronization = true,
ExternalThreading = true)]
generic<typename T>
public ref class Lazy
[<SerializableAttribute>]
[<ComVisibleAttribute(false)>]
[<HostProtectionAttribute(SecurityAction.LinkDemand, Synchronization = true,
ExternalThreading = true)>]
type Lazy<'T> = class end
Type Parameters
- T
Specifies the type of object that is being lazily initialized.
Lazy initialization occurs the first time the Lazy<(Of <(T>)>)..::.Value property is accessed or the Lazy<(Of <(T>)>)..::.ToString method is called.
Use an instance of Lazy<(Of <(T>)>) to defer the creation of a large or resource-intensive object or the execution of a resource-intensive task, particularly when such creation or execution might not occur during the lifetime of the program.
System..::.Object
System..::.Lazy<(Of <(T>)>)
System..::.Lazy<(Of <(T, TMetadata>)>)
By default, all public and protected members of the Lazy<(Of <(T>)>) class are thread safe and may be used concurrently from multiple threads. These thread-safety guarantees may be removed optionally and per instance, using parameters to the type's constructors.
Windows 7, Windows Vista, Windows XP SP2, Windows Server 2008, Windows Server 2003
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
.NET Framework
Supported in: 4
.NET Framework Client Profile
Supported in: 4
Reference
Other Resources