diff options
author | Peter Jas <necmon@yahoo.com> | 2016-07-18 22:03:29 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-07-18 12:03:29 -0700 |
commit | e9774389f13862104605a092921d4e3872524096 (patch) | |
tree | c2a882751577c88c4d2272e371c04c69edf3d303 /src | |
parent | 6d9906925d65fb96ccb8bf31298673c6581a62b9 (diff) | |
download | coreclr-e9774389f13862104605a092921d4e3872524096.tar.gz coreclr-e9774389f13862104605a092921d4e3872524096.tar.bz2 coreclr-e9774389f13862104605a092921d4e3872524096.zip |
Add Lazy<T>(T value) constructor (#6304)
Fix dotnet/corefx#2578
Diffstat (limited to 'src')
-rw-r--r-- | src/mscorlib/model.xml | 1 | ||||
-rw-r--r-- | src/mscorlib/src/System/Lazy.cs | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/mscorlib/model.xml b/src/mscorlib/model.xml index b951881869..fa5c9c0722 100644 --- a/src/mscorlib/model.xml +++ b/src/mscorlib/model.xml @@ -3134,6 +3134,7 @@ </Type> <Type Name="System.Lazy<T>"> <Member Name="#ctor"/> + <Member Name="#ctor(T)"/> <Member Name="#ctor(System.Func<T>)"/> <Member Name="#ctor(System.Boolean)"/> <Member Name="#ctor(System.Threading.LazyThreadSafetyMode)"/> diff --git a/src/mscorlib/src/System/Lazy.cs b/src/mscorlib/src/System/Lazy.cs index 053052696d..903c19c2ad 100644 --- a/src/mscorlib/src/System/Lazy.cs +++ b/src/mscorlib/src/System/Lazy.cs @@ -126,6 +126,19 @@ namespace System } /// <summary> + /// Initializes a new instance of the <see cref="T:System.Threading.Lazy{T}"/> class that + /// uses a pre-initialized specified value. + /// </summary> + /// <remarks> + /// An instance created with this constructor should be usable by multiple threads + // concurrently. + /// </remarks> + public Lazy(T value) + { + m_boxed = new Boxed(value); + } + + /// <summary> /// Initializes a new instance of the <see cref="T:System.Threading.Lazy{T}"/> class that uses a /// specified initialization function. /// </summary> |