PutridParrot.Options/OptionExtensions.cs
/// <summary>
/// If the Option is Some then invoke the supplied action,
/// otherwise do nothing.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="option"></param>
/// <param name="action"></param>
If the Option is Some then invoke the supplied action,
otherwise do nothing.
If the Option is Some then invoke the supplied action otherwise do nothing .
public static void Do<T>(this Option<T> option, Action<T> action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }
            if (option is Some<T> some)
            {
                action(some.Value);
            }
        }
public static void Do < T > ( this Option < T > option , Action < T > action ) { if ( action == null ) { throw new ArgumentNullException ( nameof ( action ) ) ; } if ( option is Some < T > some ) { action ( some . Value ) ; } }
If the Option is Some then invoke the supplied action,
otherwise do nothing.
If the Option is Some then invoke the supplied action otherwise do nothing .
Option<T>
this
action
Action<T>
None
option
None
typeparam
None