Exemple #1
0
        public override bool ValueOrCast <TMatched>(out T value, out Matched <TMatched> matched)
        {
            value   = default;
            matched = noMatch <TMatched>();

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

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

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