public GamerFactoryDynamic( IPopcornService popcorn, ISweatyPalmsService palms, IChineseTakeawayService takeaway, IUnderpantsService pants, IGamingHeadsetService headset) { this.popcorn = popcorn; this.palms = palms; this.takeaway = takeaway; this.pants = pants; this.headset = headset; }
public GamerFactoryTypeSwitch( IPopcornService popcorn, ISweatyPalmsService palms, IChineseTakeawayService takeaway, IUnderpantsService pants, IGamingHeadsetService headset) { this.popcorn = popcorn; this.palms = palms; this.takeaway = takeaway; this.pants = pants; this.headset = headset; this.factoryMethodByGame = new Dictionary<Type, Func<IGame, IGamer>>() { { typeof(MarioKartGame), this.InternalCreateGamer1 }, { typeof(CallOfDutyGame),this.InternalCreateGamer2 } }; }