1 静态代理 public interface methodinterface { void function (); //默认为public } //外用应用程序调用此类,只负责调用 public static class Service { public void function () { methodfactory.MI.function(); } } //实现接口 public classs methodclass : methodinterface { public void function() { System.console.write("hello"); } } //工厂模式,产生实例 public static class methodfactory { private static methodinterface mi = new methodclass(); public static methodinterface MI { get{return mi;} set {if(value)==null throw new ArgumentNullException() mi = value; } } } public class program { public static void main(string[] args) { Service.function() } } 2 非静态 public interface methodinterface { void function (); //默认为public } //外用应用程序调用此类,只负责调用 public class Service : methodinterface { public void function () { methodfactory.MI.function(); } } //实现接口 public classs methodclass : methodinterface { public void function() { System.console.write("hello"); } } //工厂模式,产生实例 public static class methodfactory { private static methodinterface mi = new methodclass(); public static methodinterface MI { get{return mi;} set {if(value)==null throw new ArgumentNullException() mi = value; } } } public class program { public static void main(string[] args) { Service s = new Service(); s.function(); } } 区别就是非静态的调用类可以去实现接口。