/// <summary> /// information resulted from parsing one parameter in a list of parameters. /// </summary> /// <param name="parameterInfo"> /// An instance of <see cref="ParameterInfo"/> class. /// </param> /// <exception cref="InvalidParameterException"> /// Thrown when an attempt to add same parameter is a second time is made. /// </exception> internal void Add(ParameterInfo parameterInfo) { string parameterName = this.isCaseSensitive ? parameterInfo.ParameterName : parameterInfo.ParameterName.ToUpperInvariant(); if (this.ParameterWasSpecified(parameterName)) { throw new InvalidParameterException(string.Format(CultureInfo.InvariantCulture, "Parameter {0} is specified more than once", parameterInfo.ParameterName)); } this.Parameters[parameterName] = parameterInfo; }
/// <summary> /// Attempt to get the parameter information for the given parameter. /// </summary> /// <param name="parameterName"> /// The parameter for witch the parameter information is retrieved. /// </param> /// <param name="parameterInfo"> /// At return will contain parameter information if the parameter is found; /// otherwise, null. /// </param> /// <returns> /// true if the parameter information was found, otherwise, false. /// </returns> public bool TryGetParameterInfo(string parameterName, out ParameterInfo parameterInfo) { if (parameterName == null) { throw new ArgumentNullException("parameterName"); } parameterName = this.isCaseSensitive ? parameterName : parameterName.ToUpperInvariant(); return this.Parameters.TryGetValue(parameterName, out parameterInfo); }