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

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

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

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