Class ParameterInt
- Namespace
- TechnologySolutions.Rfid.AsciiProtocol.Parameters
- Assembly
- TechnologySolutions.Rfid.AsciiProtocol.Core.dll
Defines a parameter that is an optional integer
public class ParameterInt : ParameterBase<int?>, IParameterAndValue<int?>, IParameterValue<int?>, ICommandParameter, IParameterAction
- Inheritance
-
ParameterInt
- Implements
- Inherited Members
Constructors
ParameterInt(string, int, int)
Initializes a new instance of the ParameterInt class for decimal values
public ParameterInt(string identifier, int minimum, int maximum)
Parameters
identifierstringThe character(s) that identify the parameter on the command line
minimumintThe maximum permitted value when not null
maximumintThe minimum permitted value when not null
ParameterInt(string, int, int, string)
Initializes a new instance of the ParameterInt class
public ParameterInt(string identifier, int minimum, int maximum, string parseFormat)
Parameters
identifierstringThe character(s) that identify the parameter on the command line
minimumintThe maximum permitted value when not null
maximumintThe minimum permitted value when not null
parseFormatstringA format string to output the value to the command line. This also indicates whether the value should be parsed as hex ("X" or decimal "D")
ParameterInt(string, string)
Initializes a new instance of the ParameterInt class
public ParameterInt(string identifier, string parseFormat)
Parameters
identifierstringThe character(s) that identify the parameter on the command line
parseFormatstringA format string to output the value to the command line. This also indicates whether the value should be parsed as hex (e.g. "X2" or decimal "D")
Properties
Maximum
Gets the maximum permitted value
public int Maximum { get; }
Property Value
Minimum
Gets the minimum permitted value
public int Minimum { get; }
Property Value
Methods
CheckValue(int?)
Checks that value is within the accepted range if the value is not null
protected override int? CheckValue(int? value)
Parameters
valueint?The value to check
Returns
- int?
The checked value
ParseValue(string)
Attempt to parse the value from the command line and assign value to the parsed value
protected override int? ParseValue(string value)
Parameters
valuestringThe value to parse
Returns
- int?
Exceptions
- ArgumentOutOfRangeException
If the value is outside the permitted range
- FormatException
If the parameter is not in the expected format