Class BarCodeDefinition
The base class for bar code definitions.
public abstract class BarCodeDefinition
- Inheritance
-
BarCodeDefinition
- Derived
- Inherited Members
Methods
GetNumbersIfMatched(string)
Attempts to match the bar code to this bar code definition.
public abstract BarCodeMatch GetNumbersIfMatched(string barCode)
Parameters
barCode
stringThe bar code to attempt to match to this definition.
Returns
- BarCodeMatch
If the bar code matches this definition, a BarCodeMatch instance containing the numbers found in the bar code; otherwise, null.
Exceptions
- ArgumentNullException
barCode
is null.
Parse(string, string)
Creates a new bar code definition of a particular syntax.
public static BarCodeDefinition Parse(string syntax, string format)
Parameters
syntax
stringThe syntax name that specifies what type of bar code definition should be created. This can be either "Text" or "IsoIec15434Format06". If this is null or empty, "Text" is used by default.
format
stringThe syntax-specific format for the bar code definition. See the derived classes for details about the expected format.
Returns
- BarCodeDefinition
An instance of a concrete bar code definition class, depending on the syntax name.
Remarks
This will validate that all number identifiers match the ones in ValidIds.
Exceptions
- ArgumentNullException
format
is null.- ArgumentException
syntax
is not a known bar code syntax name.- FormatException
format
is not a valid format for the given syntax.
Parse(string, string, IEnumerable<string>)
Creates a new bar code definition of a particular syntax.
public static BarCodeDefinition Parse(string syntax, string format, IEnumerable<string> validNumberIds)
Parameters
syntax
stringThe syntax name that specifies what type of bar code definition should be created. This can be either "Text" or "IsoIec15434Format06". If this is null or empty, "Text" is used by default.
format
stringThe syntax-specific format for the bar code definition. See the derived classes for details about the expected format.
validNumberIds
IEnumerable<string>An optional list of identifiers that will be used to validate the number identifiers in the bar code format. If this is null, the number identifiers will not be validated.
Returns
- BarCodeDefinition
An instance of a concrete bar code definition class, depending on the syntax name.
Exceptions
- ArgumentNullException
format
is null.- ArgumentException
syntax
is not a known bar code syntax name.- FormatException
format
is not a valid format for the given syntax.
ValidateNumberId(string)
Validates a number id.
protected static void ValidateNumberId(string id)
Parameters
id
stringThe number id to check.
Remarks
This will validate that the number identifier matches one in ValidIds.
This is for convenience in derived class constructors.
Exceptions
- FormatException
id
is not a valid number id.
ValidateNumberId(string, IEnumerable<string>)
Validates a number id.
protected static void ValidateNumberId(string id, IEnumerable<string> validNumberIds)
Parameters
id
stringThe number id to check.
validNumberIds
IEnumerable<string>An optional list of identifiers that will be used to validate the number identifier. If this is null, the number identifiers will not be validated.
Remarks
This is for convenience in derived class constructors.
Exceptions
- FormatException
id
is not a valid number id.