Dictionary ve anonymous method calling ile temiz olur.




static IDictionary> PROCESS_MAP = new Dictionary>(){
{"Topla", new Func(addIt)},
{"Çıkar", new Func(subtractIt)},
{"Çarp", new Func(multipleIt)},
{"Böl", new Func(divideIt)}

};

public static void Main(string[] args)
{


Console.WriteLine(PROCESS_MAP["Topla"].DynamicInvoke(1, 2));

}

private static int addIt(int param1, int param2){
return param1 + param2;
}

private static int subtractIt(int param1, int param2){
return param1 - param2;
}

private static int multipleIt(int param1, int param2){
return param1 - param2;
}

private static int divideIt(int param1, int param2){
return param1 / param2;
}