/// <summary> /// Sets the default case for the current switch statement. /// </summary> /// <typeparam name="TSource">The type of the source.</typeparam> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="switchDeclaration">The switch declaration.</param> /// <param name="result">The result.</param> /// <returns>The switch statement.</returns> public static ISwitch <TSource, TResult> Default <TSource, TResult>(this ISwitchDeclaration <TSource> switchDeclaration, Expression <Func <TSource, TResult> > result) { return(switchDeclaration.CreateForResultType <TResult>().Default(result)); }
/// <summary> /// Sets the default case for the current switch statement. /// </summary> /// <typeparam name="TSource">The type of the source.</typeparam> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="switchDeclaration">The switch declaration.</param> /// <param name="result">The result.</param> /// <returns>The switch statement.</returns> public static ISwitch <TSource, TResult> Default <TSource, TResult>(this ISwitchDeclaration <TSource> switchDeclaration, TResult result) { return(switchDeclaration.Default(r => result)); }
/// <summary> /// Adds a case to the current switch statement. /// </summary> /// <typeparam name="TSource">The type of the source.</typeparam> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="switchDeclaration">The switch declaration.</param> /// <param name="condition">The condition.</param> /// <param name="result">The result.</param> /// <returns>The switch statement.</returns> public static ISwitch <TSource, TResult> Case <TSource, TResult>(this ISwitchDeclaration <TSource> switchDeclaration, Expression <Func <TSource, bool> > condition, TResult result) { return(switchDeclaration.Case(condition, i => result)); }
/// <summary> /// Adds a case to the current switch statement. /// </summary> /// <typeparam name="TSource">The type of the source.</typeparam> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="switchDeclaration">The switch declaration.</param> /// <param name="condition">The condition.</param> /// <param name="result">The result.</param> /// <returns>The switch statement.</returns> public static ISwitch <TSource, TResult> Case <TSource, TResult>(this ISwitchDeclaration <TSource> switchDeclaration, Expression <Func <TSource, bool> > condition, Expression <Func <TSource, TResult> > result) { return(switchDeclaration.CreateForResultType <TResult>().Case(condition, result)); }
/// <summary> /// Adds a case to the current switch statement. /// </summary> /// <typeparam name="TSource">The type of the source.</typeparam> /// <typeparam name="TResult">The type of the result.</typeparam> /// <param name="switchDeclaration">The switch declaration.</param> /// <param name="condition">The condition.</param> /// <param name="result">The result.</param> /// <returns>The switch statement.</returns> public static ISwitch <TSource, TResult> Case <TSource, TResult>(this ISwitchDeclaration <TSource> switchDeclaration, TSource condition, Expression <Func <TSource, TResult> > result) { return(switchDeclaration.Case(c => AreEqual(c, condition), result)); }