Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/System.Runtime/ref/System.Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,6 +1202,7 @@ public partial interface IProgress<in T>
public partial class Lazy<T>
{
public Lazy() { }
public Lazy(T value) { }
public Lazy(bool isThreadSafe) { }
public Lazy(System.Func<T> valueFactory) { }
public Lazy(System.Func<T> valueFactory, bool isThreadSafe) { }
Expand Down
12 changes: 12 additions & 0 deletions src/System.Runtime/tests/System/LazyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,18 @@ public static void Ctor()
VerifyLazy(lazyObject, 0, true);
}

[Theory]
[InlineData(21)]
[InlineData(366.58)]
[InlineData("hello")]
public static void Ctor_T_PreInitialized<T>(T value)
{
var lazyObject = new Lazy<T>(value);

Assert.True(lazyObject.IsValueCreated);
Assert.Equal(value, lazyObject.Value);
}

[Theory]
[InlineData(true)]
[InlineData(false)]
Expand Down