Overloading By Delegate Return Type : Func « LINQ « C# / CSharp Tutorial






using System;
using System.ComponentModel;

    class MainClass
    {
        static void Execute(Func<int> action)
        {
            Console.WriteLine("action returns an int: " + action());
        }
        static void Execute(Func<double> action)
        {
            Console.WriteLine("action returns a double: " + action());
        }

        static void Main()
        {
            Execute(() => 1);
        }

    }








22.45.Func
22.45.1.Double recursive extension
22.45.2.Accumulator function
22.45.3.Add extension to Func
22.45.4.Build the necessary Func<> delegates using anonymous methods
22.45.5.Overloading By Delegate Return Type
22.45.6.Pass the delegates into the methods of Sequence
22.45.7.Lambda Expression for Func
22.45.8.Lambda Expression to retrieve string length