PutridParrot.Options/OptionalExtensions.cs
/// <summary>
/// If the Optional has a value then invoke the supplied action,
/// otherwise do nothing.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="optional"></param>
/// <param name="action"></param>
If the Optional has a value then invoke the supplied action,
otherwise do nothing.
If the Optional has a value then invoke the supplied action otherwise do nothing .
public static void Do<T>(this Optional<T> optional, Action<T> action)
        {
            if (action == null)
            {
                throw new ArgumentNullException(nameof(action));
            }
            if (optional.IsSome)
            {
                action(optional.Value);
            }
        }
public static void Do < T > ( this Optional < T > optional , Action < T > action ) { if ( action == null ) { throw new ArgumentNullException ( nameof ( action ) ) ; } if ( optional . IsSome ) { action ( optional . Value ) ; } }
If the Optional has a value then invoke the supplied action,
otherwise do nothing.
If the Optional has a value then invoke the supplied action otherwise do nothing .
Optional<T>
this
action
Action<T>
None
optional
None
typeparam
None