コード例 #1
0
        static void Main(string[] args)
        {
            WebSiteFactory f = new WebSiteFactory();

            WebSite fx = f.GetWebSiteCategory("产品展示");

            fx.Use(new User("小菜"));

            WebSite fy = f.GetWebSiteCategory("产品展示");

            fy.Use(new User("大鸟"));

            WebSite fz = f.GetWebSiteCategory("产品展示");

            fz.Use(new User("娇娇"));

            WebSite fl = f.GetWebSiteCategory("博客");

            fl.Use(new User("老顽童"));

            WebSite fm = f.GetWebSiteCategory("博客");

            fm.Use(new User("桃谷六仙"));

            WebSite fn = f.GetWebSiteCategory("博客");

            fn.Use(new User("南海神鳄"));

            Console.WriteLine("得到网站分类总数为{0}", f.GetWebSiteCount());
        }
コード例 #2
0
        static void Main(string[] args)
        {
            WebSiteFactory f  = new WebSiteFactory();
            WebSite        fx = f.GetWebSiteCategory("产品展示");

            fx.Use(new User("小菜"));

            WebSite fy = f.GetWebSiteCategory("产品展示");

            fy.Use(new User("大鸟"));

            WebSite fz = f.GetWebSiteCategory("产品展示");

            fz.Use(new User("娇娇"));

            WebSite fl = f.GetWebSiteCategory("博客");

            fl.Use(new User("娜娜"));

            WebSite fm = f.GetWebSiteCategory("博客");

            fm.Use(new User("铁纱杏"));

            WebSite fn = f.GetWebSiteCategory("博客");

            fn.Use(new User("东好学"));

            Console.WriteLine("网站分类总数为:{0}", f.GetWebSiteCount());

            Console.ReadKey();
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: tangaoxiang/DesigneModel
        static void Main(string[] args)
        {
            WebSiteFactory f = new WebSiteFactory();

            WebSite f1 = f.GetWebSiteCategory("产品展示");

            f1.Use(new User("诸葛亮"));

            WebSite f2 = f.GetWebSiteCategory("产品展示");

            f2.Use(new User("曹操"));

            WebSite f3 = f.GetWebSiteCategory("博客");

            f3.Use(new User("刘备"));

            WebSite f4 = f.GetWebSiteCategory("博客");

            f4.Use(new User("周瑜"));

            System.Console.WriteLine($"网站分类总数为{f.GetWebSiteCount()}");
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: Jeffiy/DesignPatterns
        static void Main(string[] args)
        {
            WebSiteFactory f = new WebSiteFactory();

            WebSite fx = f.GetWebSiteCategory("产品展示");
            fx.Use(new User("小菜"));

            WebSite fy = f.GetWebSiteCategory("产品展示");
            fy.Use(new User("大鸟"));

            WebSite fz = f.GetWebSiteCategory("产品展示");
            fz.Use(new User("娇娇"));

            WebSite fl = f.GetWebSiteCategory("博客");
            fl.Use(new User("老顽童"));

            WebSite fm = f.GetWebSiteCategory("博客");
            fm.Use(new User("桃谷六仙"));

            WebSite fn = f.GetWebSiteCategory("博客");
            fn.Use(new User("南海神鳄"));

            Console.WriteLine("得到网站分类总数为{0}", f.GetWebSiteCount());
        }