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)

Converts a Long value to a String value.

public:
 static System::String ^ ToString(long Value);
public static string ToString (long Value);
static member ToString : int64 -> string
Public Shared Function ToString (Value As Long) As String

Parameters

Value
Int64

The Long value to convert.

Returns

The String representation of the Long value.

Applies to

ToString(Single, NumberFormatInfo)

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

public:
 static System::String ^ ToString(float Value, System::Globalization::NumberFormatInfo ^ NumberFormat);
public static string ToString (float Value, System.Globalization.NumberFormatInfo? NumberFormat);
public static string ToString (float Value, System.Globalization.NumberFormatInfo NumberFormat);
static member ToString : single * System.Globalization.NumberFormatInfo -> string
Public Shared Function ToString (Value As Single, NumberFormat As NumberFormatInfo) As String

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

ToString(Double, NumberFormatInfo)

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

public:
 static System::String ^ ToString(double Value, System::Globalization::NumberFormatInfo ^ NumberFormat);
public static string ToString (double Value, System.Globalization.NumberFormatInfo? NumberFormat);
public static string ToString (double Value, System.Globalization.NumberFormatInfo NumberFormat);
static member ToString : double * System.Globalization.NumberFormatInfo -> string
Public Shared Function ToString (Value As Double, NumberFormat As NumberFormatInfo) As String

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

ToString(Decimal, NumberFormatInfo)

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

public:
 static System::String ^ ToString(System::Decimal Value, System::Globalization::NumberFormatInfo ^ NumberFormat);
public static string ToString (decimal Value, System.Globalization.NumberFormatInfo? NumberFormat);
public static string ToString (decimal Value, System.Globalization.NumberFormatInfo NumberFormat);
static member ToString : decimal * System.Globalization.NumberFormatInfo -> string
Public Shared Function ToString (Value As Decimal, NumberFormat As NumberFormatInfo) As String

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

ToString(UInt64)

Important

This API is not CLS-compliant.

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

Converts a Ulong value to a String value.

public:
 static System::String ^ ToString(System::UInt64 Value);
[System.CLSCompliant(false)]
public static string ToString (ulong Value);
[<System.CLSCompliant(false)>]
static member ToString : uint64 -> string
Public Shared Function ToString (Value As ULong) As String

Parameters

Value
UInt64

The Ulong value to convert.

Returns

The String representation of the Ulong value.

Attributes

Applies to

ToString(UInt32)

Important

This API is not CLS-compliant.

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

Converts a uint value to a String value.

public:
 static System::String ^ ToString(System::UInt32 Value);
[System.CLSCompliant(false)]
public static string ToString (uint Value);
[<System.CLSCompliant(false)>]
static member ToString : uint32 -> string
Public Shared Function ToString (Value As UInteger) As String

Parameters

Value
UInt32

The Uint value to convert.

Returns

The String representation of the Uint value.

Attributes

Applies to

ToString(Single)

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

public:
 static System::String ^ ToString(float Value);
public static string ToString (float Value);
static member ToString : single -> string
Public Shared Function ToString (Value As Single) As String

Parameters

Value
Single

The Single value to convert.

Returns

The string representation of the Single value.

Applies to

ToString(Object)

Converts an object to a String value.

public:
 static System::String ^ ToString(System::Object ^ Value);
public static string ToString (object Value);
public static string? ToString (object? Value);
static member ToString : obj -> string
Public Shared Function ToString (Value As Object) As String

Parameters

Value
Object

The object to convert.

Returns

The String representation of the object.

Applies to

ToString(Int32)

Converts an integer value to a String value.

public:
 static System::String ^ ToString(int Value);
public static string ToString (int Value);
static member ToString : int -> string
Public Shared Function ToString (Value As Integer) As String

Parameters

Value
Int32

The int value to convert.

Returns

The String representation of the int value.

Applies to

ToString(Int16)

Converts a Short value to a String value.

public:
 static System::String ^ ToString(short Value);
public static string ToString (short Value);
static member ToString : int16 -> string
Public Shared Function ToString (Value As Short) As String

Parameters

Value
Int16

The Short value to convert.

Returns

The String representation of the Short value.

Applies to

ToString(Double)

Converts a Double value to a String value.

public:
 static System::String ^ ToString(double Value);
public static string ToString (double Value);
static member ToString : double -> string
Public Shared Function ToString (Value As Double) As String

Parameters

Value
Double

The Double value to convert.

Returns

The string representation of the Double value.

Applies to

ToString(Decimal)

Converts a Decimal value to a String value.

public:
 static System::String ^ ToString(System::Decimal Value);
public static string ToString (decimal Value);
static member ToString : decimal -> string
Public Shared Function ToString (Value As Decimal) As String

Parameters

Value
Decimal

The Decimal value to convert.

Returns

The String representation of the Decimal value.

Applies to

ToString(DateTime)

Converts a DateTime value to a String value.

public:
 static System::String ^ ToString(DateTime Value);
public static string ToString (DateTime Value);
static member ToString : DateTime -> string
Public Shared Function ToString (Value As DateTime) As String

Parameters

Value
DateTime

The DateTime value to convert.

Returns

The String representation of the DateTime value.

Applies to

ToString(Char)

Converts a Char value to a String.

public:
 static System::String ^ ToString(char Value);
public static string ToString (char Value);
static member ToString : char -> string
Public Shared Function ToString (Value As Char) As String

Parameters

Value
Char

The Char value to convert.

Returns

The String representation of the Char value.

Applies to

ToString(Byte)

Converts a Byte value to a String.

public:
 static System::String ^ ToString(System::Byte Value);
public static string ToString (byte Value);
static member ToString : byte -> string
Public Shared Function ToString (Value As Byte) As String

Parameters

Value
Byte

The Byte value to convert.

Returns

The String representation of the Byte value.

Applies to

ToString(Boolean)

Converts a Boolean value to a String.

public:
 static System::String ^ ToString(bool Value);
public static string ToString (bool Value);
static member ToString : bool -> string
Public Shared Function ToString (Value As Boolean) As String

Parameters

Value
Boolean

The Boolean value to convert.

Returns

The String representation of the Boolean value.

Applies to