Enum.ToString Method (String, IFormatProvider)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Note: This API is now obsolete.

This method overload is obsolete; use Enum.ToString(String).

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

[ObsoleteAttribute("The provider argument is not used. Please use ToString(String).")]
public string ToString(
	string format,
	IFormatProvider provider


Type: System.String

A format specification.

Type: System.IFormatProvider


Return Value

Type: System.String

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

Exception Condition

format does not contain a valid format specification.


format equals "X", but the enumeration type is unknown.

The format parameter can contain the "G" or "g", "D" or "d", "X" or "x", and "F" or "f" format strings (the format string is not case-sensitive). If format is null or an empty string (""), the general format specifier ("G") is used. For more information about the enumeration format strings and formatting enumeration values, see Enumeration Format Strings. For more information about formatting in general, see Formatting Types in the .NET Framework.

Specify only format; the provider parameter is obsolete.

.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top