using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
static class DoubleApplicationExtensions
{
public static Func ApplyTwice(this Func original)
{
return x => original(original(x));
}
}
class MainClass
{
static void Main()
{
Func incrementer = x => x + x;
Func doubleIncrementer = incrementer.ApplyTwice();
Console.WriteLine(doubleIncrementer(5));
}
}