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
barCodestringThe 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
barCodeis null.
Parse(string, string)
Creates a new bar code definition of a particular syntax.
public static BarCodeDefinition Parse(string syntax, string format)
Parameters
syntaxstringThe 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.
formatstringThe 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
formatis null.- ArgumentException
syntaxis not a known bar code syntax name.- FormatException
formatis 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
syntaxstringThe 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.
formatstringThe syntax-specific format for the bar code definition. See the derived classes for details about the expected format.
validNumberIdsIEnumerable<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
formatis null.- ArgumentException
syntaxis not a known bar code syntax name.- FormatException
formatis not a valid format for the given syntax.
ValidateNumberId(string)
Validates a number id.
protected static void ValidateNumberId(string id)
Parameters
idstringThe 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
idis not a valid number id.
ValidateNumberId(string, IEnumerable<string>)
Validates a number id.
protected static void ValidateNumberId(string id, IEnumerable<string> validNumberIds)
Parameters
idstringThe number id to check.
validNumberIdsIEnumerable<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
idis not a valid number id.