源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

c# 匿名方法的小例子

  • 时间:2022-02-08 21:46 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:c# 匿名方法的小例子
[u]复制代码[/u] 代码如下:
// Create a handler for a click event. button1.Click += delegate(System.Object o, System.EventArgs e)                    { System.Windows.Forms.MessageBox.Show("Click!"); };   // Create a delegate. delegate void Del(int x); // Instantiate the delegate using an anonymous method. Del d = delegate(int k) { /* ... */ };   void StartThread() {     System.Threading.Thread t1 = new System.Threading.Thread       (delegate()             {                 System.Console.Write("Hello, ");                 System.Console.WriteLine("World!");             });     t1.Start(); }
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部