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) ); }
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(); }