System.Convert.ToString Method

Converts the value of a 32-bit signed integer to its equivalent string representation in a specified base.

Syntax

public static string ToString (int value, int toBase)

Parameters

value
The 32-bit signed integer to convert.
toBase
The base of the return value, which must be 2, 8, 10, or 16.

Returns

The string representation of value in base toBase.

Remarks

If value is positive and toBase is 2, 8, or 16, the returned string uses sign-and-magnitude representation. If value is negative and toBase is 2, 8, or 16, the returned string uses two's complement representation. This means that the high-order bit of the highest-order byte (bit 31) is interpreted as the sign bit. If the Convert.ToString(int, int) method is called to create a string that will later be converted back to a number, a corresponding method that assumes a similar numeric representation should be called to perform the conversion. Such methods include Convert.ToInt32(string, int) and int.Parse(string, System.Globalization.NumberStyles).

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0