Exemple #1
0
        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();
        }
Exemple #2
0
        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();
        }