static void Main(string[] args) { var myReallyHugeText = "Really really huge text."; var lazyBookParser = new LazyBookParserProxy(myReallyHugeText); //Then expensive parsing process doesn't executed until i try to get number pages //Expensive process executed now. lazyBookParser.GetNumberPages(); }
static void Main(string[] args) { IBookParser bookParser = new LazyBookParserProxy(); Console.WriteLine(bookParser.PageCount); }