Exemplo n.º 1
0
        //--------------------------------------------------------------
        #region Creation and Cleanup
        //--------------------------------------------------------------

        /// <overloads>
        /// <summary>
        /// Initializes a new instance of the <see cref="SwitchValueArgument{T}"/> class.
        /// </summary>
        /// </overloads>
        ///
        /// <summary>
        /// Initializes a new instance of the <see cref="SwitchValueArgument{T}"/> class.
        /// </summary>
        /// <param name="name">
        /// The name of the argument. Must not be <see langword="null"/> or an empty string.
        /// </param>
        /// <param name="value">The value argument.</param>
        /// <param name="description">
        /// The argument description that will be printed as help text.
        /// Can be <see langword="null"/>.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="name"/> or <paramref name="description"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="name"/> is an empty string.
        /// </exception>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="value"/> is <see langword="null"/>.
        /// </exception>
        public SwitchValueArgument(string name, ValueArgument <T> value, string description)
            : base(name, description)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            _valueArgument = value;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SwitchValueArgument{T}"/> class.
        /// </summary>
        /// <param name="name">
        /// The name of the argument. Must not be <see langword="null"/> or an empty string.
        /// </param>
        /// <param name="value">The value argument.</param>
        /// <param name="description">
        /// The argument description that will be printed as help text.
        /// Can be <see langword="null"/>.
        /// </param>
        /// <param name="aliases">The aliases.</param>
        /// <param name="shortAliases">The short aliases.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="name"/> or <paramref name="description"/> is <see langword="null"/>.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// <paramref name="name"/> is an empty string.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// A switch name or alias has less than two characters. A single character is only allowed
        /// for the short aliases.
        /// </exception>
        /// <exception cref="ArgumentException">
        /// The switch name, alias or short alias contains invalid characters. A switch may only
        /// consist of letters, digits, or '_'.
        /// </exception>
        public SwitchValueArgument(string name, ValueArgument <T> value, string description,
                                   IEnumerable <string> aliases, IEnumerable <char> shortAliases)
            : base(name, description, aliases, shortAliases)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            _valueArgument = value;
        }