/// <summary> /// Converts the result to <see cref="Optional{T}"/>. /// </summary> /// <returns></returns> public override Optional <T> ToOptional() { return(Optional.Some(Value)); }
} // MapPartial(, function) /// <summary> /// If the current instance has a value, calls <paramref name="function"/> on it and returns <c>Some</c> the result. /// Otherwise returns <c>None</c>. /// </summary> /// <typeparam name="R">The return type of <paramref name="function"/>.</typeparam> /// <param name="function">The function.</param> public Optional <R> Map <R>(Func <T, R> function) { return(HasValue ? Optional.Some(function(_value)) : Optional <R> .None); } // Map(, function)