/// <summary> /// Match that performs the given Action if the value is the given type and /// exposes four fields. /// </summary> /// <typeparam name="TCase">The type of value to match.</typeparam> /// <param name="action">The action to perform if the value matches. May be null /// in order to match and do nothing but prevent further matches.</param> /// <returns>This Matcher or a NullMatcher if the match succeeded.</returns> public ReturnMatcher <TValue, TResult> Case <TCase, TArg1, TArg2, TArg3, TArg4>( Func <TArg1, TArg2, TArg3, TArg4, TResult> action) { IMatchable <TArg1, TArg2, TArg3, TArg4> matchable = mValue as IMatchable <TArg1, TArg2, TArg3, TArg4>; return(Case(() => (matchable != null) && (mValue is TCase), () => action(matchable.GetArg1(), matchable.GetArg2(), matchable.GetArg3(), matchable.GetArg4()))); }
/// <summary> /// Match that performs the given Action if the value is the given type and /// exposes four fields. /// </summary> /// <typeparam name="TCase">The type of value to match.</typeparam> /// <param name="action">The action to perform if the value matches. May be null /// in order to match and do nothing but prevent further matches.</param> /// <returns>This Matcher or a NullMatcher if the match succeeded.</returns> public Matcher <T> Case <TCase, TArg1, TArg2, TArg3, TArg4>( Action <TArg1, TArg2, TArg3, TArg4> action) { IMatchable <TArg1, TArg2, TArg3, TArg4> matchable = mValue as IMatchable <TArg1, TArg2, TArg3, TArg4>; return(Case(() => (matchable != null) && (mValue is TCase), () => action(matchable.GetArg1(), matchable.GetArg2(), matchable.GetArg3(), matchable.GetArg4()))); }