Exemplo n.º 1
0
        public void Clone()
        {
            var scraper  = new WebPageScraper("http://www.example.com");
            var scraper2 = (WebPageScraper)scraper.Clone(); // instead of new'ing up an object with expensive contructor, clone instead

            Assert.Equal("My Page", scraper.Title);
            Assert.Equal("My Page", scraper2.Title);
        }
Exemplo n.º 2
0
        public static void MainOne(string[] args)
        {
            var scraper = new WebPageScraper("http://www.google.com");

            scraper.PrintPageData();

            var scraper2 = scraper.Clone();

            scraper2.PrintPageData();
        }