1.拓展方法为类提供额外的方法,拓展方法在静态类中定义,定义为静态方法,
public static class StringExt{ public static void Foo(this string s){ Console.Write(s); } } //调用string s="hello";s.Foo();
拓展方法
原文:http://www.cnblogs.com/zhuxiang1633/p/7821368.html