扩展方法的要求:
1.扩展方法要求在一个静态类中
2.扩展方法本身也是静态方法
3.扩展方法第一个参数是 [this 要扩展的类 参数名称]
public class Program { static void Main() { int a = 10; int b=a.fun(); Console.WriteLine(b); } } public static class A { public static int fun(this int num) { return num * 2; } }