コード例 #1
0
ファイル: Program.cs プロジェクト: sunshyon/CSharpBase
        static void Main(string[] args)
        {
            ISearcher searcher = new ProxySearcher();

            if (searcher != null)
            {
                string result = searcher.DoSearch("杨过", "玉女心经");
            }
        }
コード例 #2
0
        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();
        }