Export (0) Print
Expand All

Convert.ToUInt32 Method (String, Int32)

Converts the String representation of a number in a specified base to an equivalent 32-bit unsigned integer.

This method is not CLS-compliant.  

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

[CLSCompliantAttribute(false)] 
public static uint ToUInt32 (
	string value,
	int fromBase
)
/** @attribute CLSCompliantAttribute(false) */ 
public static UInt32 ToUInt32 (
	String value, 
	int fromBase
)
CLSCompliantAttribute(false) 
public static function ToUInt32 (
	value : String, 
	fromBase : int
) : uint

Parameters

value

A String containing a number.

fromBase

The base of the number in value, which must be 2, 8, 10, or 16.

Return Value

A 32-bit unsigned integer equivalent to the number in value. -or- Zero if value is a null reference (Nothing in Visual Basic).

Exception typeCondition

ArgumentException

fromBase is not 2, 8, 10, or 16.

-or-

value, which represents a non-base 10 unsigned number, is prefixed with a negative sign.

FormatException

value contains a character that is not a valid digit in the base specified by fromBase. The exception message indicates there are no digits to convert if the first character in value is invalid; otherwise, the message indicates value contains invalid trailing characters.

OverflowException

value, which represents a base 10 unsigned number, is prefixed with a negative sign.

-or-

The return value is less than UInt32.MinValue or larger than UInt32.MaxValue.

If fromBase is 16, you can prefix the number specified by the value parameter with "0x" or "0X".

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft