标签:
delegate string MyDele(string str); string MyFun(string str) { return str; } private void Form1_Load(object sender, EventArgs e) { MyDele m = new MyDele(MyFun); this.Text = m("实名"); //匿名函数 //1、 this.Text = new MyDele(delegate(string str) { return str; })("匿名"); //2、用于Invoke方法中 this.Invoke(new EventHandler(delegate(object o, EventArgs e1) { })); //3、用于Invoke方法中 this.Invoke(new MethodInvoker( delegate() { })); //4、用于定义线程 System.Threading.Thread th=new System.Threading.Thread(new System.Threading.ThreadStart(delegate() { })); }
标签:
原文地址:http://www.cnblogs.com/xiaochun126/p/4233198.html