ToUInt64 Method (String, Int32)

Convert.ToUInt64 Method (String, Int32)

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

This method is not CLS-compliant.  

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

[CLSCompliantAttribute(false)] 
public static ulong ToUInt64 (
	string value,
	int fromBase
)
/** @attribute CLSCompliantAttribute(false) */ 
public static UInt64 ToUInt64 (
	String value, 
	int fromBase
)
CLSCompliantAttribute(false) 
public static function ToUInt64 (
	value : String, 
	fromBase : int
) : ulong

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 64-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 UInt64.MinValue or larger than UInt64.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 CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, 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:
© 2016 Microsoft