/// <summary> /// Match that performs the given Action if the value is the given type and /// exposes two 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>(Func <TArg1, TArg2, TResult> action) { IMatchable <TArg1, TArg2> matchable = mValue as IMatchable <TArg1, TArg2>; return(Case(() => (matchable != null) && (mValue is TCase), () => action(matchable.GetArg1(), matchable.GetArg2()))); }
/// <summary> /// Match that performs the given Action if the value is the given type and /// exposes two 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>(Action <TArg1, TArg2> action) { IMatchable <TArg1, TArg2> matchable = mValue as IMatchable <TArg1, TArg2>; return(Case(() => (matchable != null) && (mValue is TCase), () => action(matchable.GetArg1(), matchable.GetArg2()))); }