static void Main(string[] args) { var webSiteFactory = new WebSiteFactory(); var c = webSiteFactory.GetWebSite("c"); c.Use(new User("你好c")); var d = webSiteFactory.GetWebSite("d"); d.Use(new User("你好d")); var e = webSiteFactory.GetWebSite("e"); e.Use(new User("你好e")); var f = webSiteFactory.GetWebSite("f"); f.Use(new User("你好f")); var g = webSiteFactory.GetWebSite("g"); g.Use(new User("你好g")); var a = webSiteFactory.GetWebSite("c"); a.Use(new User("你好c")); var count = webSiteFactory.GetCount(); Console.WriteLine($@"总条数为:{count}"); Console.ReadKey(); }
public void Start() { WebSiteFactory wf = new WebSiteFactory(); WebSite w1 = wf.GetWebSite("w1"); w1.Use(new User("咪咪")); WebSite w2 = wf.GetWebSite("w2"); w2.Use(new User("小白")); WebSite w3 = wf.GetWebSite("w3"); w3.Use(new User("路飞")); WebSite w4 = wf.GetWebSite("w4"); w4.Use(new User("鸣人")); WebSite w5 = wf.GetWebSite("w5"); w4.Use(new User("六臂神童")); WebSite w6 = wf.GetWebSite("w6") ; w6.Use(new User("后裔")); Console.WriteLine($"网站总数:{wf.Count}"); }