1 public static class se 2 { 3 public static string getHello(this string s) 4 { 5 return "linq给我了一个扩张方法"; 6 } 7 } 8 9 class Program 10 { 11 12 static void Main(string[] args) 13 { 14 string s = ""; 15 Console.WriteLine(s.getHello()); 16 Console.Read(); 17 18 19 } 20 }
原文:http://www.cnblogs.com/ChineseMoonGod/p/5203922.html