예제 #1
0
        static void Main(string[] args)
        {
            var book  = new TheManAndTheFly();
            var proxy = new LazyBookParserProxy(book);

            Console.WriteLine(CheckFor(proxy._bookParser));
            proxy.GetNumberOfWords();
            Console.WriteLine(CheckFor(proxy._bookParser));
        }
예제 #2
0
        static void Main(string[] args)
        {
            LazyBookParserProxy lazyBookParser = new LazyBookParserProxy("Book Text");

            int pages = lazyBookParser.GetNumPages();

            Console.WriteLine(pages);

            Console.ReadKey();
        }
예제 #3
0
        private static void Main(string[] args)
        {
            const int numberOfWordsForABook = 100;
            var       aBook = GenerateABook(numberOfWordsForABook);

            var lazyBookParserProxy = new LazyBookParserProxy(aBook);

            Console.WriteLine(
                "Number of words in a book is {0} (which is {1})",
                lazyBookParserProxy.GetNumberOfWords(),
                lazyBookParserProxy.GetNumberOfWords() == numberOfWordsForABook ? "correct" : "not correct"
                );
        }