Example #1
0
        static void Main(string[] args)
        {
            DIC dc = new DIC();

            dc.Register <IBaseInterface, SomeClassRealization>();
            dc.Register <MyAbstractClass, UsefulClass> ();

            Console.WriteLine(dc.Resolve <ISomeInterface>().IsDoingNothingMethod());
            Console.WriteLine(dc.Resolve <MyAbstractClass>().UselessMethod());
        }
Example #2
0
        static void Main(string[] args)
        {
            DIC dc = new DIC();

            //Workable
            //dc.Register<ISomeInterface, SomeClassReaization>();//A1,R1:A1
            //dc.Register<MyAbstractClass, UsefullClass>();//A2,R2:A2
            //Console.WriteLine(dc.Resolve<ISomeInterface>().IsDoingNothingMethod());//true
            //Console.WriteLine(dc.Resolve<MyAbstractClass>().UselessMethod());//false

            //UnWorkable
            dc.Register <ISomeInterface, UsefullClass>();                      //A1, R2:A2-exception
            dc.Register <MyAbstractClass, SomeClassReaization>();              // R1:A1, A2-exception
            //Console.WriteLine(dc.Resolve<ISomeInterface>().IsDoingNothingMethod());//true
            Console.WriteLine(dc.Resolve <MyAbstractClass>().UselessMethod()); //false
        }