/// <summary> /// Matches the optional value. /// </summary> public static void Option <TElem, TResult>(this IMatchContext <TElem?, TResult> context, Func <TElem, Option <TResult> > func) where TElem : struct { context.Case(new OptionMatchCase <TElem, TResult>(func)); }
/// <summary> /// Destructs an array. /// </summary> public static void Array <TElem, TResult>(this IMatchContext <TElem[], TResult> context, Func <TElem, TElem, TElem, Option <TResult> > func) { context.Case(new ArrayMatchCase <TElem, TElem[], TResult>(func)); }
/// <summary> /// Matches the value against a regex. /// </summary> public static void Regex <TResult>(this IMatchContext <string, TResult> context, Regex regex, TResult value) { context.Regex(regex, () => value); }
/// <summary> /// Matches the value against a regex. /// </summary> public static void Regex <TResult>(this IMatchContext <string, TResult> context, Regex regex, Func <string, string, string, string, string, string, string, string, string, string, Option <TResult> > func) { context.Case(new RegexMatchCase <TResult>(regex, func)); }
/// <summary> /// Sets up a type check. /// </summary> public static OfTypeMatchCaseBuilder <TValue, TResult> OfType <TValue, TResult>(this IMatchContext <TValue, TResult> context) { return(new OfTypeMatchCaseBuilder <TValue, TResult>(context)); }
/// <summary> /// Matches an arbitrary pattern. /// </summary> public static PatternMatchCaseBuilder <TValue, TResult> Pattern <TValue, TResult>(this IMatchContext <TValue, TResult> context, Expression <Func <IPatternBuilder, object> > expr) { return(new PatternMatchCaseBuilder <TValue, TResult>(context, expr)); }
/// <summary> /// Destructs a tuple. /// </summary> public static void Tuple <T1, T2, T3, T4, T5, T6, T7, TRest, TResult>(this IMatchContext <ValueTuple <T1, T2, T3, T4, T5, T6, T7, TRest>, TResult> context, Func <T1, T2, T3, T4, T5, T6, T7, TRest, Option <TResult> > func) where TRest : struct { context.Case(new TupleMatchCase <ValueTuple <T1, T2, T3, T4, T5, T6, T7, TRest>, TResult>(func)); }
/// <summary> /// Returns a default value. /// </summary> public static void Default <TValue, TResult>(this IMatchContext <TValue, TResult> context, TResult result) { context.Case(new DefaultMatchCase <TValue, TResult>(() => result)); }
/// <summary> /// Checks if the matched value equals a given value. /// </summary> public static void Value <TValue, TResult>(this IMatchContext <TValue, TResult> context, TValue value, Func <Option <TResult> > func) { context.Case(new ValueMatchCase <TValue, TResult>(value, func)); }
/// <summary> /// Destructs a tuple. /// </summary> public static void Tuple <T1, T2, T3, T4, T5, T6, TResult>(this IMatchContext <ValueTuple <T1, T2, T3, T4, T5, T6>, TResult> context, Func <T1, T2, T3, T4, T5, T6, Option <TResult> > func) { context.Case(new TupleMatchCase <ValueTuple <T1, T2, T3, T4, T5, T6>, TResult>(func)); }
/// <summary> /// Destructs a tuple. /// </summary> public static void Tuple <T1, T2, TResult>(this IMatchContext <Tuple <T1, T2>, TResult> context, Func <T1, T2, Option <TResult> > func) { context.Case(new TupleMatchCase <Tuple <T1, T2>, TResult>(func)); }
/// <summary> /// Destructs a sequence. /// </summary> public static void SeqRest <TElem, TResult>(this IMatchContext <IEnumerable <TElem>, TResult> context, Func <TElem, TElem, TElem, TElem, TElem, TElem, TElem, TElem, TElem, IEnumerable <TElem>, Option <TResult> > func) { context.Case(new SeqRestMatchCase <TElem, IEnumerable <TElem>, TResult>(func)); }
/// <summary> /// Binds the value to a new name. /// </summary> public static void Default <TValue, TResult>(this IMatchContext <TValue, TResult> context, Func <TValue, Option <TResult> > func) { context.Case(new DefaultBindMatchCase <TValue, TResult>(func)); }
public PatternMatchCaseBuilder(IMatchContext <TValue, TResult> context, Expression <Func <IPatternBuilder, object> > expr) { _context = context; _expr = expr; }
/// <summary> /// Checks if the matched value equals a given value. /// </summary> public static void Value <TValue, TResult>(this IMatchContext <TValue, TResult> context, TValue value, TResult result) { context.Case(new ValueMatchCase <TValue, TResult>(value, () => result)); }
public ResolveContext( IMatchContext <IValueBuilder> valueContext, IMatchContext <IReferenceConverter> referenceContext) { ValueContext = valueContext; ReferenceContext = referenceContext; }
public OfTypeMatchCaseBuilder(IMatchContext <TValue, TResult> context) { _context = context; }