Example of Function Delegates in C#

Below is a sample code snippet that demonstrates the function delegates or lambda expression in C# .

Example of Function Delegates in C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ACSample
{
    class Program
    {
        static void Main(string[] args)
        {
            // Example of Funcition Delegate / Lambda Expression to add 2 numbers
            Func<int, int, int> Lambda = (a, b) => (a + b);
            Console.WriteLine(Lambda(1, 2));
            Console.ReadLine();
        }

    }
}