From 41018bf83c2c041ff442509782a83430d9df7d8a Mon Sep 17 00:00:00 2001 From: Peter Jas Date: Sun, 17 Jul 2016 21:58:57 +0000 Subject: [PATCH] Add Lazy(T value) constructor --- src/System.Private.CoreLib/src/System/Lazy.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/System.Private.CoreLib/src/System/Lazy.cs b/src/System.Private.CoreLib/src/System/Lazy.cs index 2cefb5b94de..a2b1b930a00 100644 --- a/src/System.Private.CoreLib/src/System/Lazy.cs +++ b/src/System.Private.CoreLib/src/System/Lazy.cs @@ -124,6 +124,19 @@ public Lazy(Func valueFactory) { } + /// + /// Initializes a new instance of the class that + /// uses a pre-initialized specified value. + /// + /// + /// An instance created with this constructor should be usable by multiple threads + // concurrently. + /// + public Lazy(T value) + { + _boxed = new Boxed(value); + } + /// /// Initializes a new instance of the /// class that uses 's default constructor and a specified thread-safety mode.