2 using System.Collections.Generic;
\r
4 using System.Threading;
\r
6 using System.Globalization;
\r
8 namespace Microsoft.Internal
\r
10 internal static class LazyServices
\r
12 public static Lazy<T> AsLazy<T>(this T t)
\r
15 return new Lazy<T>(() => t, false);
\r
18 public static T GetNotNullValue<T>(this Lazy<T> lazy, string argument)
\r
21 Assumes.NotNull(lazy);
\r
22 T value = lazy.Value;
\r
25 throw new InvalidOperationException(
\r
26 string.Format(CultureInfo.CurrentCulture, Strings.LazyServices_LazyResolvesToNull, typeof(T), argument));
\r