PutridParrot.Options/OptionalExtensions.cs
/// <summary>
/// If the Optional has a value and the supplied condition is true,
/// returns the Optional otherwise returns and Optional.None
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="optional"></param>
/// <param name="condition"></param>
/// <returns></returns>
If the Optional has a value and the supplied condition is true,
returns the Optional otherwise returns and Optional.None
If the Optional has a value and the supplied condition is true returns the Optional otherwise returns and Optional . None
public static Optional<T> If<T>(this Optional<T> optional, bool condition)
        {
            return optional.IsSome && condition ?
                optional : Optional<T>.None;
        }
public static Optional < T > If < T > ( this Optional < T > optional , bool condition ) { return optional . IsSome && condition ? optional : Optional < T > . None ; }
If the Optional has a value and the supplied condition is true,
returns the Optional otherwise returns and Optional.None
If the Optional has a value and the supplied condition is true returns the Optional otherwise returns and Optional . None
None
Optional<T>
this
condition
bool
None
optional
None
typeparam
None