public static void MainFunction() { IMessageWriter writer = new ConsoleMessageWriter(); var salutation = new Salutation(writer); salutation.Exclaim(); }
public static void MainFunction() { var typeName = ConfigurationManager.AppSettings["messageWriter"]; var type = Type.GetType(typeName, false); IMessageWriter writer = (IMessageWriter)Activator.CreateInstance(type); var salutation = new Salutation(writer); salutation.Exclaim(); }