Example #1
0
        public void IfHasValue(Action <T> action)
        {
            Checker.Null <ArgumentNullException>(action);

            if (HasValue)
            {
                action(value);
            }
        }
Example #2
0
        public IMaybe <TResult> Bind <TResult>(Func <T, IMaybe <TResult> > function)
        {
            Checker.Null <ArgumentNullException>(function);

            if (HasValue)
            {
                return(function.Invoke(value));
            }
            return(Maybe <TResult> .None);
        }
Example #3
0
        public T ValueOr(Func <T> function)
        {
            Checker.Null <ArgumentNullException>(function);

            if (HasValue)
            {
                return(value);
            }

            return(function.Invoke());
        }
Example #4
0
 public T ValueOr(Func <T> function)
 {
     Checker.Null <ArgumentNullException>(function);
     return(value);
 }
Example #5
0
 public IMaybe <TResult> Bind <TResult>(Func <T, TResult> function)
 {
     Checker.Null <ArgumentNullException>(function);
     return(Maybe <TResult> .Of(function.Invoke(value)));
 }
Example #6
0
 public void IfHasValue(Action <T> action)
 {
     Checker.Null <ArgumentNullException>(action);
     action.Invoke(value);
 }
Example #7
0
 public IMaybe <TResult> Bind <TResult>(Func <T, IMaybe <TResult> > function)
 {
     Checker.Null <ArgumentNullException>(function);
     return(None <TResult> .Of());
 }