This documentation is archived and is not being maintained.

UInt64.ToString Method (String, IFormatProvider)

Converts the numeric value of this instance to its equivalent string representation using the specified format and culture-specific format information.

This method is not CLS-compliant.  

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

Public Function ToString ( _
	format As String, _
	provider As IFormatProvider _
) As String
Dim instance As ULong
Dim format As String
Dim provider As IFormatProvider
Dim returnValue As String

returnValue = instance.ToString(format, provider)
public final String ToString (
	String format, 
	IFormatProvider provider
public final function ToString (
	format : String, 
	provider : IFormatProvider
) : String



A format specification.


An IFormatProvider that supplies culture-specific formatting information about this instance.

Return Value

The string representation of the value of this instance as specified by format and provider.

Exception typeCondition


The format parameter is invalid.

If format is a null reference (Nothing in Visual Basic) or an empty string (""), the return value for this instance is formatted with the general format specifier ("G").

The provider parameter is an IFormatProvider that obtains a NumberFormatInfo. The NumberFormatInfo provides culture-specific format information about this instance. If provider is a null reference (Nothing in Visual Basic), the return value for this instance is formatted with the NumberFormatInfo for the current culture.

The following example demonstrates the ToString method.

No code example is currently available or this language may not be supported.
public class Temperature implements IFormattable
    /// <summary>
    /// IFormattable.ToString implementation.
    /// </summary>
    public String ToString(String format, IFormatProvider provider)
        if (format != null && format.Equals("F")) {
            return String.Format("{0}'F",
        return ((Int64)mValue).ToString(format, provider);
    } //ToString

    // The value holder
    protected long mValue;

    /** @property 
    public long get_Value()
        return mValue;
    } //get_Value

    /** @property 
    public void set_Value(long value)
        mValue = value;
    } //set_Value
} //Temperature

public class Temperature implements IFormattable {
    /// <summary>
    /// IFormattable.ToString implementation.
    /// </summary>
    public function ToString(format : String, provider : IFormatProvider) : String {
        if( format != null && format.Equals("F") ) {
            return String.Format("{0}'F", m_value.ToString());

        return m_value.ToString(format, provider);

    // The value holder
    protected var m_value : ulong;

    public function get Value() : ulong {
        return m_value;
            public function set Value(value : ulong) {                        
        m_value = value;

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