12 private readonly
object _syncRoot =
new object();
14 private readonly Func<T> _delegate;
15 private bool _isValueCreated;
23 : this(() => (T)
Csla.Reflection.MethodCaller.CreateInstance(typeof(T))) { }
32 _delegate = @delegate;
43 get {
return _isValueCreated; }
60 _value = _delegate.Invoke();
61 _isValueCreated =
true;
An alternative to Lazy<T>
LazySingleton()
Initializes a new instance of the LazySingleton<T> class.
T Value
Gets the instance.
bool IsValueCreated
Gets a value indicating whether this instance is initilized and contains a value.
LazySingleton(Func< T > @delegate)
Initializes a new instance of the LazySingleton<T> class.