public LazyConverter(TTo to, Func <TTo, TFrom> backwardConvert) { backwardConvert.EnsureNotNull(nameof(backwardConvert)); // _toHolder = new ValueHolderClass <TTo>(value: to); _fromHolder = null; _backwardConvert = backwardConvert; _convert = null; }
public LazyConverter(TFrom from, Func <TFrom, TTo> convert) { convert.EnsureNotNull(nameof(convert)); // _toHolder = null; _fromHolder = new ValueHolderClass <TFrom>(value: from); _backwardConvert = null; _convert = convert; }
public static void Dispose <T>(this ValueHolderClass <T> holder, Exception exception = default) where T : IDisposable { if (!(holder is null)) { try { holder.ValueExceptionTolerant?.Dispose(); } catch (Exception secondException) { if (exception is null) { throw; } else { throw new AggregateException(exception, secondException); } } } }