Exemplo n.º 1
0
        public override bool ValueOrCast <TMatched>(out T value, out Matched <TMatched> matched)
        {
            value   = default;
            matched = noMatch <TMatched>();

            return(false);
        }
Exemplo n.º 2
0
        public override bool ValueOrCast <TMatched>(out T value, out Matched <TMatched> matched)
        {
            value   = default;
            matched = failedMatch <TMatched>(exception);

            return(false);
        }
Exemplo n.º 3
0
        public override bool ValueOrOriginal(out T value, out Matched <T> original)
        {
            value    = default;
            original = this;

            return(false);
        }
Exemplo n.º 4
0
 public override Matched <TResult> Select <TResult>(Matched <T> result, Func <T, TResult> func)
 {
     return(failedMatch <TResult>(exception));
 }
Exemplo n.º 5
0
 public override Matched <TResult> Select <TResult>(Matched <T> result, Func <T, TResult> func) => noMatch <TResult>();
Exemplo n.º 6
0
 public override bool EqualToValueOf(Matched <T> otherMatched) => false;
Exemplo n.º 7
0
 public override Matched <T> Or(Matched <T> other) => other;
Exemplo n.º 8
0
 public override bool Else <TOther>(out Matched <TOther> result)
 {
     result = failedMatch <TOther>(exception);
     return(true);
 }
Exemplo n.º 9
0
 void handle(Matched <T> match)
 {
     if (match.If(out var value, out var exception) && matched.If(out var action))
     {
         action(value);
     }
Exemplo n.º 10
0
 public override bool Else <TOther>(out Matched <TOther> result)
 {
     result = noMatch <TOther>();
     return(true);
 }
Exemplo n.º 11
0
 public abstract Matched <TResult> Select <TResult>(Matched <T> result, Func <T, TResult> func);
Exemplo n.º 12
0
 public MatchingContext(Matched <T> matched) => this.matched = matched;
Exemplo n.º 13
0
 public Matching(Matched <T> matched)
 {
     this.matched = matched;
     action       = MonadFunctions.none <Func <TResult> >();
 }
Exemplo n.º 14
0
 public abstract bool EqualToValueOf(Matched <T> otherMatched);
Exemplo n.º 15
0
 public abstract bool WasMatched(out Matched <T> matched);
Exemplo n.º 16
0
 public abstract bool Else <TOther>(out Matched <TOther> result);
Exemplo n.º 17
0
 public abstract bool ValueOrCast <TMatched>(out T value, out Matched <TMatched> matched);
Exemplo n.º 18
0
 public abstract bool ValueOrOriginal(out T value, out Matched <T> original);
Exemplo n.º 19
0
 public override bool WasMatched(out Matched <T> matched)
 {
     matched = this;
     return(false);
 }
Exemplo n.º 20
0
 public abstract Matched <T> Or(Matched <T> other);