using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Reflection; namespace codeTest { class Program { delegate int myDeletegate(int args0); delegate TResult myFunc<Targ0, TResult>(Targ0 arg0); static void Main(string[] args) { myDeletegate my = new myDeletegate(ShowNumber); //c# 2.0 Anonymous Method myDeletegate myA = delegate(int args0) { return args0; }; //c# 3.0 expression myDeletegate myB = (x) => { return x; }; myFunc<int, int> myC = (x) => { return x; }; Console.WriteLine(my(10)); Console.WriteLine(myA(10)); Console.WriteLine(myB(10)); Console.WriteLine(myC(10)); Console.ReadLine(); } static int ShowNumber(int args0) { return args0; } } }