FunSharp.Common/UpdateExtensions.cs
//--------------------------------------------------
/// <summary>
/// Resolve the value of updating an existing value.
/// </summary>
Resolve the value of updating an existing value.
Resolve the value of updating an existing value .
public static Option<T> Resolve<T>(
            [NotNull] this Update<T> update,
            [NotNull] Option<T> existingValue)
        {
            if (update is null) throw new ArgumentNullException(nameof(update));
            if (existingValue is null) throw new ArgumentNullException(nameof(existingValue));
            switch (update)
            {
                case UpdateClear<T> _: return Option<T>.None;
                case UpdateIgnore<T> _: return existingValue;
                case UpdateSet<T> updateSet: return updateSet.Value.ToOption();
                default: throw new ArgumentOutOfRangeException(nameof(update));
            }
        }
public static Option < T > Resolve < T > ( [ NotNull ] this Update < T > update , [ NotNull ] Option < T > existingValue ) { if ( update is null ) throw new ArgumentNullException ( nameof ( update ) ) ; if ( existingValue is null ) throw new ArgumentNullException ( nameof ( existingValue ) ) ; switch ( update ) { case UpdateClear < T > _ : return Option < T > . None ; case UpdateIgnore < T > _ : return existingValue ; case UpdateSet < T > updateSet : return updateSet . Value . ToOption ( ) ; default : throw new ArgumentOutOfRangeException ( nameof ( update ) ) ; } }
Resolve the value of updating an existing value.
Resolve the value of updating an existing value .
this
[NotNull]
Option<T>
[NotNull]