标签:style blog color os cti for
1 private void Form1_Load(object sender, EventArgs e) 2 { 3 Print<string>("here"); 4 Print<int>(1222); 5 6 GenericCollections<string> gcl = new GenericCollections<string>(); 7 gcl.Add("这是一个字符串的示例"); 8 DisplayResult<string>(gcl); 9 GenericCollections<string> gcl2 = new GenericCollections<string>(); 10 gcl2.Add(true.ToString()); 11 DisplayResult<string>(gcl2); 12 Console.ReadLine(); 13 } 14 15 public void Print<T>(T argument) 16 { 17 Console.WriteLine(argument.ToString()); 18 } 19 20 void DisplayResult<T>(GenericCollections<T> gcl) 21 { 22 foreach (T s in gcl) 23 { 24 Console.WriteLine(s.ToString()); 25 } 26 }
标签:style blog color os cti for
原文地址:http://www.cnblogs.com/illday/p/3823096.html