ISayHello getSayHello() { var clock = new UtcClock(); var printer = new ConsolePrinterWithTime(clock, new ConsolePrinter()); ISayHello hello = new DIDemo(printer); return hello; }
void RunDIDemo2() { var clock = new UtcClock(); var printer = new ConsolePrinterWithTime(clock, new ConsolePrinter()); ISayHello hello = new DIDemo(printer); //<- this is what you resolve from your container //...... hello.SayHello("Tim"); }