Class ParameterEnum<TEnum>
- Namespace
- TechnologySolutions.Rfid.AsciiProtocol.Parameters
- Assembly
- TechnologySolutions.Rfid.AsciiProtocol.Core.dll
Defines a parameter that is derived from a specific set of values defined by an Enum (with appropriate extensions)
public class ParameterEnum<TEnum> : ParameterBase<TEnum?>, IParameterAndValue<TEnum?>, IParameterValue<TEnum?>, ICommandParameter, IParameterAction where TEnum : struct
Type Parameters
TEnum
The type of the enum
- Inheritance
-
ParameterBase<TEnum?>ParameterEnum<TEnum>
- Implements
-
IParameterAndValue<TEnum?>IParameterValue<TEnum?>
- Inherited Members
Constructors
ParameterEnum(string)
Initializes a new instance of the ParameterEnum class
public ParameterEnum(string identifier)
Parameters
identifier
stringThe character(s) that identify the parameter on the command line
Methods
AppendToCommandLine(StringBuilder)
Appends the parameter to the command line if the value is not NotSpecified
public override void AppendToCommandLine(StringBuilder line)
Parameters
line
StringBuilderThe command line to append to
CheckValue(TEnum?)
Called when setting value to ensure the new value is valid
protected override TEnum? CheckValue(TEnum? value)
Parameters
value
TEnum?The value to check
Returns
- TEnum?
The new value to store
Exceptions
- ArgumentException
If the value assigned is not valid
ParseValue(string)
Attempt to parse the value from the command line and assign value to the parsed value
protected override void ParseValue(string value)
Parameters
value
stringThe value to parse
Exceptions
- ArgumentOutOfRangeException
If the value is outside the permitted range
- FormatException
If the parameter is not in the expected format