Exemplo n.º 1
0
        static void Main(string[] args)
        {
            //int sum1 =  Exec(() => sum(1, 2));
            //  string sumInString = Exec(() => sumToString(1, 3));

            Student s = Exec(() => RakeshFactoryManagement <IStudent>
                             .Create()
                             .GetStudent(3)
                             );
        }
Exemplo n.º 2
0
        public static T Create()
        {
            string   implementation = typeof(T).Name;
            Func <T> cons;


            RakeshFactoryManagement <IStudent> .Register(implementation, () => new Student());

            if (dictionary.TryGetValue(implementation, out cons))
            {
                return(cons());
            }

            throw new NotImplementedException();
        }