Class LazyRetry<T>
A utility class that allows you to lazily retry the creation of an instance of type T.
public class LazyRetry<T>
Type Parameters
T
- Inheritance
-
LazyRetry<T>
- Inherited Members
- Extension Methods
Constructors
LazyRetry(Func<T?>)
Pass in the logic that tries to resolve your service.
public LazyRetry(Func<T?> factory)
Parameters
factory
Func<T>
Properties
Value
Returns the cached instance if non-null, otherwise calls your factory again.
public T? Value { get; }
Property Value
- T
Operators
implicit operator T?(LazyRetry<T>)
Try to hand this to something expecting a T; just returns .Value.
public static implicit operator T?(LazyRetry<T> lazy)
Parameters
lazy
LazyRetry<T>
Returns
- T