System.Convert.ToUInt32 Method

Converts the specified string representation of a number to an equivalent 32-bit unsigned integer, using the specified culture-specific formatting information.

Syntax

[System.CLSCompliant(false)]
public static uint ToUInt32 (string value, IFormatProvider provider)

Parameters

value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.

Returns

A 32-bit unsigned integer that is equivalent to the number in value, or 0 (zero) if value is null.

Exceptions

TypeReason
ArgumentNullException value is a null reference.
FormatException value cannot be converted to a numeric value.
OverflowExceptionThe numeric value of value is greater than uint.MaxValue or less than uint.MinValue.

Remarks

The return value is the result of invoking uint.Parse(string) on value.

provider is an IFormatProvider instance that obtains a System.Globalization.NumberFormatInfo object. The System.Globalization.NumberFormatInfo object provides culture-specific information about the format of value. If provider is null, the System.Globalization.NumberFormatInfo for the current culture is used.

If you prefer not to handle an exception if the conversion fails, you can call the uint.TryParse(string, UInt32@) method instead. It returns a bool value that indicates whether the conversion succeeded or failed.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0