示例#1
0
        public ValueArgument(string name, string description)
            : base(name, description)
        {
            var type = typeof(T);

            if (type == typeof(Enum))
            {
                throw new ArgumentException("ValueArgument does not support enumeration as value type. Use EnumArgument instead.");
            }

            if (!ObjectHelper.CanParse(type))
            {
                throw new NotSupportedException(Invariant($"ValueArguments of type {type.Name} are not supported. The type must provide a TypeConverter that allows conversions from String."));
            }
        }