Class NumberHelpers
Helper methods for dealing with model and serial numbers.
public static class NumberHelpers
- Inheritance
-
NumberHelpers
- Inherited Members
Methods
IsValid(string, bool, out string)
Returns whether the specified string is a valid number (i.e., all characters in the string are valid characters for model or serial numbers).
public static bool IsValid(string number, bool validateNotEmpty, out string errorMessage)
Parameters
number
stringThe string to test.
validateNotEmpty
boolWhether to validate that the number is not empty.
errorMessage
stringWill be set to the error message if the number is invalid, or null if valid.
Returns
Remarks
Valid number characters are those that are printable ASCII characters (i.e., ASCII codes 32 to 126, decimal).
Exceptions
- ArgumentNullException
number
is null.
IsValid(string, out string)
Returns whether the specified string is a valid number (i.e., all characters in the string are valid characters for model or serial numbers).
public static bool IsValid(string number, out string errorMessage)
Parameters
number
stringThe string to test.
errorMessage
stringWill be set to the error message if the number is invalid, or null if valid.
Returns
Remarks
Empty strings are considered valid.
Valid number characters are those that are printable ASCII characters (i.e., ASCII codes 32 to 126, decimal).
Exceptions
- ArgumentNullException
number
is null.