/// <summary> /// Initializes a new instance of the <see cref="ParameterMapping"/> class. /// </summary> /// <param name="identifier">An object by which the parameter is identified.</param> /// <param name="behaviour">The parameter behaviour.</param> /// <param name="shortNames">The paramater short names.</param> /// <param name="longNames">The parameter long names.</param> public ParameterMapping(object identifier, ParameterBehaviour behaviour, IEnumerable <string> shortNames = null, IEnumerable <string> longNames = null) { if (!Enum.IsDefined(typeof(ParameterBehaviour), behaviour)) { throw new ArgumentException($"The {nameof(ParameterBehaviour)} must be a defined value.", nameof(behaviour)); } _identifier = identifier ?? throw new ArgumentNullException(nameof(identifier)); _behaviour = behaviour; _shortNames = new HashSet <string>(shortNames ?? new string[0]); _longNames = new HashSet <string>(longNames ?? new string[0]); }
/// <summary> /// Initializes a new instance of the <see cref="CSF.Cli.ParameterMapping"/> class. /// </summary> /// <param name="identifier">An object by which the parameter is identified.</param> /// <param name="behaviour">The parameter behaviour.</param> /// <param name="shortNames">The paramater short names.</param> /// <param name="longNames">The parameter long names.</param> public ParameterMapping(object identifier, ParameterBehaviour behaviour, IEnumerable <string> shortNames = null, IEnumerable <string> longNames = null) { if (identifier == null) { throw new ArgumentNullException(nameof(identifier)); } if (!behaviour.IsDefinedValue()) { throw new ArgumentException("Behaviour must be a defined enumeration constant.", nameof(behaviour)); } _identifier = identifier; _behaviour = behaviour; _shortNames = new HashSet <string>(shortNames ?? new string[0]); _longNames = new HashSet <string>(longNames ?? new string[0]); }