static void Main(string[] args) { //MyDI.Register<IMessage, ConsoleMessage>(); MyDI.Register <IMessage, FileMessage>(); SendMessage("Hi Poor DI"); Console.WriteLine("Press any key for continuing..."); Console.ReadKey(); }
static void Main(string[] args) { // 當要變更使用 ConsoleMessage 型別功能的時候,該如何因應呢? //MyDI.Register<IMessage, ConsoleMessage>(); // 進行註冊抽象與具體實作型別 MyDI.Register <IMessage, FileMessage>(); SendMessage("Hi Poor DI"); Console.WriteLine("Press any key for continuing..."); Console.ReadKey(); }