Conversions.ToString Method

Definition

Converts the specified object to a String value.

Overloads

ToString(Int64)

Converts a Long value to a String value.

ToString(Single, NumberFormatInfo)

Converts a Single value to a String value, using the specified number format.

ToString(Double, NumberFormatInfo)

Converts a Double value to a String value, using the specified number format.

ToString(Decimal, NumberFormatInfo)

Converts a Decimal value to a String value, using the specified number format.

ToString(UInt64)

Converts a Ulong value to a String value.

ToString(UInt32)

Converts a uint value to a String value.

ToString(Single)

Converts a Single value (a single-precision floating point number) to a String value.

ToString(Object)

Converts an object to a String value.

ToString(Int32)

Converts an integer value to a String value.

ToString(Int16)

Converts a Short value to a String value.

ToString(Double)

Converts a Double value to a String value.

ToString(Decimal)

Converts a Decimal value to a String value.

ToString(DateTime)

Converts a DateTime value to a String value.

ToString(Char)

Converts a Char value to a String.

ToString(Byte)

Converts a Byte value to a String.

ToString(Boolean)

Converts a Boolean value to a String.

ToString(Int64)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Long value to a String value.

C#
public static string ToString(long Value);

Parameters

Value
Int64

The Long value to convert.

Returns

The String representation of the Long value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Single, NumberFormatInfo)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Single value to a String value, using the specified number format.

C#
public static string ToString(float Value, System.Globalization.NumberFormatInfo? NumberFormat);
C#
public static string ToString(float Value, System.Globalization.NumberFormatInfo NumberFormat);

Parameters

Value
Single

The Single value to convert.

NumberFormat
NumberFormatInfo

The number format to use, according to NumberFormatInfo.

Returns

The string representation of the Single value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ToString(Double, NumberFormatInfo)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Double value to a String value, using the specified number format.

C#
public static string ToString(double Value, System.Globalization.NumberFormatInfo? NumberFormat);
C#
public static string ToString(double Value, System.Globalization.NumberFormatInfo NumberFormat);

Parameters

Value
Double

The Double value to convert.

NumberFormat
NumberFormatInfo

The number format to use, according to NumberFormatInfo.

Returns

The string representation of the Double value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ToString(Decimal, NumberFormatInfo)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Decimal value to a String value, using the specified number format.

C#
public static string ToString(decimal Value, System.Globalization.NumberFormatInfo? NumberFormat);
C#
public static string ToString(decimal Value, System.Globalization.NumberFormatInfo NumberFormat);

Parameters

Value
Decimal

The decimal value to convert.

NumberFormat
NumberFormatInfo

The number format to use, according to NumberFormatInfo.

Returns

The String representation of the Decimal value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

ToString(UInt64)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Int64)

Converts a Ulong value to a String value.

C#
[System.CLSCompliant(false)]
public static string ToString(ulong Value);

Parameters

Value
UInt64

The Ulong value to convert.

Returns

The String representation of the Ulong value.

Attributes

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(UInt32)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Important

This API is not CLS-compliant.

CLS-compliant alternative
Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Int32)

Converts a uint value to a String value.

C#
[System.CLSCompliant(false)]
public static string ToString(uint Value);

Parameters

Value
UInt32

The Uint value to convert.

Returns

The String representation of the Uint value.

Attributes

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Single)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Single value (a single-precision floating point number) to a String value.

C#
public static string ToString(float Value);

Parameters

Value
Single

The Single value to convert.

Returns

The string representation of the Single value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Object)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts an object to a String value.

C#
public static string ToString(object Value);
C#
public static string? ToString(object? Value);

Parameters

Value
Object

The object to convert.

Returns

The String representation of the object.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Int32)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts an integer value to a String value.

C#
public static string ToString(int Value);

Parameters

Value
Int32

The int value to convert.

Returns

The String representation of the int value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Int16)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Short value to a String value.

C#
public static string ToString(short Value);

Parameters

Value
Int16

The Short value to convert.

Returns

The String representation of the Short value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Double)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Double value to a String value.

C#
public static string ToString(double Value);

Parameters

Value
Double

The Double value to convert.

Returns

The string representation of the Double value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Decimal)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Decimal value to a String value.

C#
public static string ToString(decimal Value);

Parameters

Value
Decimal

The Decimal value to convert.

Returns

The String representation of the Decimal value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(DateTime)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a DateTime value to a String value.

C#
public static string ToString(DateTime Value);

Parameters

Value
DateTime

The DateTime value to convert.

Returns

The String representation of the DateTime value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Char)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Char value to a String.

C#
public static string ToString(char Value);

Parameters

Value
Char

The Char value to convert.

Returns

The String representation of the Char value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Byte)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Byte value to a String.

C#
public static string ToString(byte Value);

Parameters

Value
Byte

The Byte value to convert.

Returns

The String representation of the Byte value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0

ToString(Boolean)

Source:
Conversions.vb
Source:
Conversions.vb
Source:
Conversions.vb

Converts a Boolean value to a String.

C#
public static string ToString(bool Value);

Parameters

Value
Boolean

The Boolean value to convert.

Returns

The String representation of the Boolean value.

Applies to

.NET 10 ja muut versiot
Tuote Versiot
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
UWP 10.0