Byte.ToString Method (String)

 
System_CAPS_noteNote

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

Converts the value of the current Byte object to its equivalent string representation using the specified format.

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

member ToString : 
        format:string -> string

Parameters

format
Type: System.String

A numeric format string.

Return Value

Type: System.String

The string representation of the current Byte object, formatted as specified by the format parameter.

Exception Condition
FormatException

format includes an unsupported specifier. Supported format specifiers are listed in the Remarks section.

The format parameter can be either a standard or a custom numeric format string. All standard numeric format strings other than "R" (or "r") are supported, as are all custom numeric format characters. If format is null or an empty string (""), the return value is formatted with the general numeric format specifier ("G").

The return value of this function is formatted using the NumberFormatInfo object for the thread current culture. For information about the thread current culture, see Thread.CurrentCulture. To provide formatting information for cultures other than the current culture, call the Byte.ToString(String, IFormatProvider) method.

The .NET Framework provides extensive formatting support, which is described in greater detail in the following formatting topics:

The following example initializes a Byte value and displays it to the console using each of the supported standard format strings and a custom format string. The example is run with en-US as the current culture.

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: