Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit e977438

Browse files
Peter Jasjkotas
authored andcommitted
Add Lazy<T>(T value) constructor (#6304)
Fix dotnet/corefx#2578
1 parent 6d99069 commit e977438

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/mscorlib/model.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3134,6 +3134,7 @@
31343134
</Type>
31353135
<Type Name="System.Lazy&lt;T&gt;">
31363136
<Member Name="#ctor"/>
3137+
<Member Name="#ctor(T)"/>
31373138
<Member Name="#ctor(System.Func&lt;T&gt;)"/>
31383139
<Member Name="#ctor(System.Boolean)"/>
31393140
<Member Name="#ctor(System.Threading.LazyThreadSafetyMode)"/>

src/mscorlib/src/System/Lazy.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,19 @@ public Lazy()
125125
{
126126
}
127127

128+
/// <summary>
129+
/// Initializes a new instance of the <see cref="T:System.Threading.Lazy{T}"/> class that
130+
/// uses a pre-initialized specified value.
131+
/// </summary>
132+
/// <remarks>
133+
/// An instance created with this constructor should be usable by multiple threads
134+
// concurrently.
135+
/// </remarks>
136+
public Lazy(T value)
137+
{
138+
m_boxed = new Boxed(value);
139+
}
140+
128141
/// <summary>
129142
/// Initializes a new instance of the <see cref="T:System.Threading.Lazy{T}"/> class that uses a
130143
/// specified initialization function.

0 commit comments

Comments
 (0)