/// <summary>
        /// Sets the parameter configuration, and Value.  If we
        /// don't have enough information in the DefaultValue or
        /// ChoiceList, we return false
        /// </summary>
        /// <param name="config"></param>
        /// <returns>True = success</returns>
        public bool SetConfiguration(MultiValueStringConfig config)
        {
            Config = config as ParameterConfig;

            // Determine what the Value collection should be
            //
            // The rule is: if there is a ChoiceList, then that is
            // what is used for the working Value.  Otherwise, the
            // DefaultValue is used if that is valid, otherwise we
            // fail and return false.
            if (config.ChoiceList != null && config.ChoiceList.Count > 0)
            {
                List <GPString> list = new List <GPString>();
                foreach (Choice choice in config.ChoiceList)
                {
                    list.Add(choice.Value as GPString);
                }
                Value = new GPMultiValue <GPString>(config.Name, list);
                return(true);
            }
            else if (config.DefaultValue != null)
            {
                Value = config.DefaultValue;
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Sets the parameter configuration, and Value.  If we
        /// don't have enough information in the DefaultValue or
        /// ChoiceList, we return false
        /// </summary>
        /// <param name="config"></param>
        /// <returns>True = success</returns>
        public bool SetConfiguration(MultiValueStringConfig config)
        {
            Config = config as ParameterConfig;

            // Determine what the Value collection should be
            //
            // The rule is: if there is a ChoiceList, then that is
            // what is used for the working Value.  Otherwise, the 
            // DefaultValue is used if that is valid, otherwise we 
            // fail and return false.
            if (config.ChoiceList != null && config.ChoiceList.Count > 0)
            {
                List<GPString> list = new List<GPString>();
                foreach (Choice choice in config.ChoiceList)
                {
                    list.Add(choice.Value as GPString);
                }
                Value = new GPMultiValue<GPString>(config.Name, list);
                return true;
            }
            else if (config.DefaultValue != null)
            {
                Value = config.DefaultValue;
                return true;
            }
            return false;
        }
        private void UpdateValue(bool?addValue, object choiceValue)
        {
            var changedValue = choiceValue as GPString;

            if (changedValue == null)
            {
                return;
            }

            if (_multiValue == null)
            {
                _multiValue = new List <GPString>();
            }

            bool adding = (addValue.HasValue && addValue.Value);
            // check if the string in in the Value collection
            GPString obj    = null;
            bool     exists = false;

            foreach (GPString item in _multiValue)
            {
                if (item.Value.Equals(changedValue.Value))
                {
                    obj    = item;
                    exists = true;
                    break;
                }
            }
            if (adding)
            {
                if (!exists)
                {
                    _multiValue.Add(changedValue);
                }
            }
            else
            {
                if (exists)
                {
                    _multiValue.Remove(obj);
                }
            }

            val = new GPMultiValue <GPString>(val.Name, _multiValue);
        }
        private void UpdateValue(bool? addValue, object choiceValue)
        {
            var changedValue = choiceValue as GPString;
            if (changedValue == null)
                return;

            if (_multiValue == null)
                _multiValue = new List<GPString>();

            bool adding = (addValue.HasValue && addValue.Value);
            // check if the string in in the Value collection
            GPString obj = null;
            bool exists = false;
            foreach (GPString item in _multiValue)
            {
                if (item.Value.Equals(changedValue.Value))
                {
                    obj = item;
                    exists = true;
                    break;
                }
            }
            if (adding)
            {
                if (!exists)
                    _multiValue.Add(changedValue);
            }
            else
            {
                if (exists)
                    _multiValue.Remove(obj);
            }

            val = new GPMultiValue<GPString>(val.Name, _multiValue);
        }