ThrowIfNotNumber Method
Definition
ThrowIfNotNumber(string, NumberStyles, IFormatProvider, string, string)
Validates and throws an ArgumentException if the specified argument is not a number.
public static void ThrowIfNotNumber(string argument, NumberStyles styles = NumberStyles.Number, IFormatProvider provider = null, string message = "Value must be a number.", string paramName = null)
Parameters
argumentstringThe value to be evaluated.
stylesNumberStylesA bitwise combination of NumberStyles values that indicates the permitted format of
argument.providerIFormatProviderAn IFormatProvider that supplies culture-specific formatting information about
argument.messagestringA message that describes the error.
paramNamestringThe name of the parameter that caused the exception.
Exceptions
- ArgumentException
argumentmust be a number.