1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| using System; using System.Collections.Generic; using System.Text; using System.Reflection; using System.Configuration;
namespace ConsoleApplication1 { internal interface SportMan { void Come(); }
class ChineseSportMan : SportMan { public void Come() { Console.WriteLine("中国运动员来了~~~"); } }
class RussianSportMan : SportMan { public void Come() { Console.WriteLine("俄罗斯运动员来了~~~"); } }
class TheController { public static SportMan CreateSportMan() { return (SportMan) Assembly.Load("ConsoleApplication1") .CreateInstance("ConsoleApplication1." + ConfigurationSettings.AppSettings["Nation"].ToString()); } }
class Client { public static void Main() { TheController.CreateSportMan().Come(); } } }
|