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