文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>一段C#程序,让你知道 匿名函数,委..

一段C#程序,让你知道 匿名函数,委..

时间:2010-09-12  来源:legend050bbb

 

  1. #define test1  
  2. //#define test2  
  3. using System;  
  4. using System.Collections.Generic;  
  5. using System.Text;  
  6.  
  7. namespace cmdTest  
  8. {  
  9.     class Program  
  10.     {  
  11.         delegate void ShowLine(string linemessage);  
  12.         static void Main(string[] args)  
  13.         {  
  14.  
  15.  
  16. #if test1  
  17.  
  18.             ShowLine line = delegate(string s)  
  19.             {  
  20.                 Console.WriteLine(s);  
  21.             };  
  22.  
  23.             line("test1\t"+@"http://hi.baidu.com/snowleung");  
  24. #endif  
  25.  
  26. #if test2  
  27.             ShowLine line=new ShowLine(show);  
  28.                       line("test2\t"@"http://hi.baidu.com/snowleung");  
  29. #endif  
  30.  
  31.             Console.ReadKey();  
  32.         }  
  33.  
  34.         static void show(string s)  
  35.         {  
  36.         Console.WriteLine(s);  
  37.         }  
  38.     }  

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载