Exemple #1
0
        /// <summary> Adds a parameter to the page being called. </summary>
        /// <param name="name"> Name of the parameter. </param>
        /// <param name="value"> Value of the parameter. </param>
        public UrlBuilder MergeParameter(string name, object value)
        {
            Requires.IsNotNullOrEmpty(name, "name");
            Requires.IsNotNull(value, "value");

            this.parameters[name] = CultureInvariantConverter.GetValue(value);

            return(this);
        }
Exemple #2
0
        /// <summary>
        /// Adds the parameter and throws an exception when a key already exists.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <exception cref="System.InvalidOperationException">The parameter key ' + key + ' already exists.</exception>
        public UrlBuilder AddParameter(string key, object value)
        {
            if (this.parameters.Keys.Contains(key))
            {
                throw new InvalidOperationException("The parameter key '" + key + "' already exists.");
            }

            this.parameters.Add(key, CultureInvariantConverter.GetValue(value));

            return(this);
        }