Exemplo n.º 1
0
        public static void Execute2()
        {
            var instance = new NewMath <int>(1, 2, (a, b) => {
                sum += a;
                sum += b;
                return(sum);
            });

            Console.WriteLine($"Adding 1 and 2 yields {instance.Sum()}"); // if 2 functions are wired up, the sum will be 6 not 3 because the methods all run

            var another = new NewMath <decimal>(1.5m, 2.2m, (a, b) => a + b);

            Console.WriteLine($"Adding decimal values yields {another.Sum()}");
        }
Exemplo n.º 2
0
 public static void Execute()
 {
     var instance = new NewMath <int>(1, 2, MyAdd);
 }