/// <summary> /// Converts the current instance to an optional of specific type with exception. /// </summary> /// <typeparam name="TU">The specific type of optional.</typeparam> /// <param name="exception">The exception to be used.</param> /// <returns>An optional with exception value.</returns> /// <exception cref="ArgumentNullException">The <paramref name="exception"/> is null.</exception> public Optional <TU> ToException <TU>(Exception exception) => exception.AsOptional <TU>();
/// <summary> /// Converts the current instance to an optional with exception. /// </summary> /// <param name="exception">The exception to be used.</param> /// <returns>An optional with exception value.</returns> /// <exception cref="ArgumentNullException">The <paramref name="exception"/> is null.</exception> public Optional <T> ToException(Exception exception) => exception.AsOptional <T>();