// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; namespace MR { public class Program { public static IDictionary FourOps(double a, double b) { return new Dictionary { { "plus", a + b }, { "minus", a - b } , { "multiply", a * b } , { "divide", a / b } }; } public static void Main(string[] args) { double a = 3.0; double b = 2.0; IDictionary res = FourOps(a, b); Console.WriteLine("{0} + {1} = {2}", a, b, res["plus"]); Console.WriteLine("{0} - {1} = {2}", a, b, res["minus"]); Console.WriteLine("{0} * {1} = {2}", a, b, res["multiply"]); Console.WriteLine("{0} / {1} = {2}", a, b, res["divide"]); Console.ReadKey(); } } }