Untitled

mail@pastecode.io avatar
unknown
csharp
3 years ago
547 B
1
Indexable
Never
using System;
using System.Collections.Generic;
using System.Linq;

public class Program
{
  private delegate int Calculate(int x, int y);

  private static int Add(int x, int y) => x + y;

  private static int Subtract(int x, int y) => x - y;


    static void Main()
    {
      var addOperation = new Calculate(Program.Add);
      var subtractOperation = new Calculate(Program.Subtract);
      Calculate multiplyOperation = (x, y) => x * y;

      Console.WriteLine(addOperation(5, 3));
      Console.WriteLine(multiplyOperation(2, 2));
    }
}