UInt32::ToString Method (IFormatProvider^)

 

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

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

public:
virtual String^ ToString(
	IFormatProvider^ provider
) sealed

Parameters

provider
Type: System::IFormatProvider^

An object that supplies culture-specific formatting information.

Return Value

Type: System::String^

The string representation of the value of this instance, which consists of a sequence of digits ranging from 0 to 9, without a sign or leading zeros.

The ToString(IFormatProvider^) method formats a UInt32 value in the default ("G", or general) format by using the NumberFormatInfo object of a specified culture. If you want to specify a different format or the current culture, use the other overloads of the ToString method, as follows:

To use format

For culture

Use the overload

Default ("G") format

Default (current) culture

ToString()

A specific format

Default (current) culture

ToString(String^)

A specific format

A specific culture

ToString(String^, IFormatProvider^)

The provider parameter is an IFormatProvider implementation. Its GetFormat method returns a NumberFormatInfo object that provides culture-specific formatting information. However, none of the properties of the NumberFormatInfo are used when formatting with the general numeric format specifier ("G").

The following example formats a 16-bit signed integer value by using several format providers, including one for the invariant culture. The output from the example illustrates that the formatted string returned by the ToString(IFormatProvider^) method is the same regardless of the format provider.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: