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)); }
static void Main(string[] args) { LazyBookParserProxy lazyBookParser = new LazyBookParserProxy("Book Text"); int pages = lazyBookParser.GetNumPages(); Console.WriteLine(pages); Console.ReadKey(); }
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" ); }