private Lazy(Func<T>? valueFactory, LazyThreadSafetyMode mode, bool useDefaultConstructor) { if (valueFactory == null && !useDefaultConstructor) throw new ArgumentNullException(nameof(valueFactory)); _factory = valueFactory; _state = LazyHelper.Create(mode, useDefaultConstructor); }
private Lazy(Func <T>?valueFactory, LazyThreadSafetyMode mode, bool useDefaultConstructor) { if (!useDefaultConstructor) { ArgumentNullException.ThrowIfNull(valueFactory); } _factory = valueFactory; _state = LazyHelper.Create(mode, useDefaultConstructor); }