コード例 #1
0
        private void AddToken(EnumStrategy key
                              , Type strategy)
        {
            KeyValuePair <EnumStrategy, Type> token = new KeyValuePair <EnumStrategy, Type>(key, strategy);

            _strategyPull.Add(token);
        }
コード例 #2
0
        public IMoveStrategy GetMoveStrategy(EnumStrategy key)
        {
            Type strategyType = _strategyPull.FirstOrDefault(x => x.Key.Equals(key))
                                .Value;

            return((IMoveStrategy)Activator.CreateInstance(strategyType));
        }