Esempio n. 1
0
        /// <summary>
        /// Returns the index of the <see cref="PythonParameter"/> object
        /// </summary>
        /// <param name="parameter">The <see cref="PythonParameter"/> object in the collection</param>
        /// <returns>The index of the <see cref="PythonParameter"/> object with the specified name</returns>
        public int IndexOf(PythonParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }

            return(IndexOf(parameter.ParameterName));
        }
Esempio n. 2
0
        /// <summary>
        /// Indicates whether a <see cref="PythonParameter"/> exists in the collection
        /// </summary>
        /// <param name="parameter">The <see cref="PythonParameter"/> to look for</param>
        /// <returns>true if the <see cref="PythonParameter"/> is in the collection; otherwise false</returns>
        public bool Contains(PythonParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }
            if (string.IsNullOrWhiteSpace(parameter.ParameterName))
            {
                throw new ArgumentException("ParameterName property can't be null or empty");
            }

            return(_list.ContainsKey(parameter.ParameterName));
        }
Esempio n. 3
0
        /// <summary>
        /// Adds the specified <see cref="PythonParameter"/> object to the <see cref="PythonParameterCollection"/>
        /// </summary>
        /// <param name="parameter">The value of the <see cref="PythonParameter"/> to add to the collection</param>
        /// <returns>The index of the <see cref="PythonParameter"/> object in the collection</returns>
        public int Add(PythonParameter parameter)
        {
            if (parameter == null)
            {
                throw new ArgumentNullException(nameof(parameter));
            }
            if (string.IsNullOrWhiteSpace(parameter.ParameterName))
            {
                throw new ArgumentException("ParameterName property can't be null or empty", nameof(parameter));
            }
            if (_list.ContainsKey(parameter.ParameterName))
            {
                throw new ArgumentException("The given key is already exist", nameof(parameter));
            }

            _list.Add(parameter.ParameterName, parameter);
            return(_list.Count - 1);
        }