static void Main(string[] args) { ISearcher searcher = new ProxySearcher(); if (searcher != null) { string result = searcher.DoSearch("杨过", "玉女心经"); } }
static void Main11() { Console.WriteLine("Hello Proxy Pattern"); //读取配置文件 //string proxy = ConfigurationManager.AppSettings["proxy"]; string proxy = "_11ProxyPattern.ProxySearcher"; //反射生成对象,针对抽象编程,客户端无须分辨真实主题类和代理类 ISearcher searcher = new ProxySearcher(); string result = searcher.DoSearch("Mr Yang", "Yu Nv Xin Jing"); Console.Read(); Console.ReadLine(); }