I would like use a switch statement which takes several variables and looks like this:
switch (intVal1, strVal2, boolVal3)
{
case 1, \"hello\", false:
My downright crazy take on this:
class Program
{
static void Main(string[] args)
{
var i = 1;
var j = 34;
var k = true;
Match(i, j, k).
With(1, 2, false).Do(() => Console.WriteLine("1, 2, 3")).
With(1, 34, false).Do(() => Console.WriteLine("1, 34, false")).
With(x => i > 0, x => x < 100, x => x == true).Do(() => Console.WriteLine("1, 34, true"));
}
static Matcher Match(T1 t1, T2 t2, T3 t3)
{
return new Matcher(t1, t2, t3);
}
}
public class Matcher
{
private readonly object[] values;
public object[] Values
{
get { return values; }
}
public Matcher(T1 t1, T2 t2, T3 t3)
{
values = new object[] { t1, t2, t3 };
}
public Match With(T1 t1, T2 t2, T3 t3)
{
return new Match(this, new object[] { t1, t2, t3 });
}
public Match With(Func t1, Func t2, Func t3)
{
return new Match(this, t1, t2, t3);
}
}
public class Match
{
private readonly Matcher matcher;
private readonly object[] matchedValues;
private readonly Func