一段C#程序,让你知道 匿名函数,委..
时间:2010-09-12 来源:legend050bbb
- #define test1
- //#define test2
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace cmdTest
- {
- class Program
- {
- delegate void ShowLine(string linemessage);
- static void Main(string[] args)
- {
- #if test1
- ShowLine line = delegate(string s)
- {
- Console.WriteLine(s);
- };
- line("test1\t"+@"http://hi.baidu.com/snowleung");
- #endif
- #if test2
- ShowLine line=new ShowLine(show);
- line("test2\t"@"http://hi.baidu.com/snowleung");
- #endif
- Console.ReadKey();
- }
- static void show(string s)
- {
- Console.WriteLine(s);
- }
- }
- }
相关阅读 更多 +