← Interactive API Explorer
Namespace: System

Convert

Converts a base data type to another base data type.

Methods (28)

bool ToBoolean(String)
Converts the specified string representation of a logical value to its Boolean equivalent.
ParameterDescription
valueA string that contains the value of either TrueString or FalseString.
Returns: true if value equals TrueString, or false if value equals FalseString or null.
byte ToByte(String,Int32)
Converts the string representation of a number in a specified base to an equivalent 8-bit unsigned integer.
ParameterDescription
valueA string that contains the number to convert.
fromBaseThe base of the number in value, which must be 2, 8, 10, or 16.
Returns: An 8-bit unsigned integer that is equivalent to the number in value, or 0 (zero) if value is null.
sbyte ToSByte(String,Int32)
Converts the string representation of a number in a specified base to an equivalent 8-bit signed integer.
ParameterDescription
valueA string that contains the number to convert.
fromBaseThe base of the number in value, which must be 2, 8, 10, or 16.
Returns: An 8-bit signed integer that is equivalent to the number in value, or 0 (zero) if value is null.
char ToChar(String)
Converts the first character of a specified string to a Unicode character.
ParameterDescription
valueA string of length 1.
Returns: A Unicode character that is equivalent to the first and only character in value.
long ToInt64(String,Int32)
Converts the string representation of a number in a specified base to an equivalent 64-bit signed integer.
ParameterDescription
valueA string that contains the number to convert.
fromBaseThe base of the number in value, which must be 2, 8, 10, or 16.
Returns: A 64-bit signed integer that is equivalent to the number in value, or 0 (zero) if value is null.
ulong ToUInt64(String,Int32)
Converts the string representation of a number in a specified base to an equivalent 64-bit unsigned integer.
ParameterDescription
valueA string that contains the number to convert.
fromBaseThe base of the number in value, which must be 2, 8, 10, or 16.
Returns: A 64-bit unsigned integer that is equivalent to the number in value, or 0 (zero) if value is null.
int ToInt32(String,Int32)
Converts the string representation of a number in a specified base to an equivalent 32-bit signed integer.
ParameterDescription
valueA string that contains the number to convert.
fromBaseThe base of the number in value, which must be 2, 8, 10, or 16.
Returns: A 32-bit signed integer that is equivalent to the number in value, or 0 (zero) if value is null.
uint ToUInt32(String,Int32)
Converts the string representation of a number in a specified base to an equivalent 32-bit unsigned integer.
ParameterDescription
valueA string that contains the number to convert.
fromBaseThe base of the number in value, which must be 2, 8, 10, or 16.
Returns: A 32-bit unsigned integer that is equivalent to the number in value, or 0 (zero) if value is null.
short ToInt16(String,Int32)
Converts the string representation of a number in a specified base to an equivalent 16-bit signed integer.
ParameterDescription
valueA string that contains the number to convert.
fromBaseThe base of the number in value, which must be 2, 8, 10, or 16.
Returns: A 16-bit signed integer that is equivalent to the number in value, or 0 (zero) if value is null.
ushort ToUInt16(String,Int32)
Converts the string representation of a number in a specified base to an equivalent 16-bit unsigned integer.
ParameterDescription
valueA string that contains the number to convert.
fromBaseThe base of the number in value, which must be 2, 8, 10, or 16.
Returns: A 16-bit unsigned integer that is equivalent to the number in value, or 0 (zero) if value is null.
long ToInt64(String)
Converts the specified string representation of a number to an equivalent 64-bit signed integer.
ParameterDescription
valueA string that contains a number to convert.
Returns: A 64-bit signed integer that is equivalent to the number in value, or 0 (zero) if value is null.
ulong ToUInt64(String)
Converts the specified string representation of a number to an equivalent 64-bit unsigned integer.
ParameterDescription
valueA string that contains the number to convert.
Returns: A 64-bit signed integer that is equivalent to the number in value, or 0 (zero) if value is null.
int ToInt32(String)
Converts the specified string representation of a number to an equivalent 32-bit signed integer.
ParameterDescription
valueA string that contains the number to convert.
Returns: A 32-bit signed integer that is equivalent to the number in value, or 0 (zero) if value is null.
uint ToUInt32(String)
Converts the specified string representation of a number to an equivalent 32-bit unsigned integer.
ParameterDescription
valueA string that contains the number to convert.
Returns: A 32-bit unsigned integer that is equivalent to the number in value, or 0 (zero) if value is null.
short ToInt16(String)
Converts the specified string representation of a number to an equivalent 16-bit signed integer.
ParameterDescription
valueA string that contains the number to convert.
Returns: A 16-bit signed integer that is equivalent to the number in value, or 0 (zero) if value is null.
ushort ToUInt16(String)
Converts the specified string representation of a number to an equivalent 16-bit unsigned integer.
ParameterDescription
valueA string that contains the number to convert.
Returns: A 16-bit unsigned integer that is equivalent to the number in value, or 0 (zero) if value is null.
double ToDouble(String)
Converts the specified string representation of a number to an equivalent double-precision floating-point number.
ParameterDescription
valueA string that contains the number to convert.
Returns: A double-precision floating-point number that is equivalent to the number in value, or 0 (zero) if value is null.
float ToSingle(String)
Converts the specified string representation of a number to an equivalent single-precision floating-point number.
ParameterDescription
valueA string that contains the number to convert.
Returns: A single-precision floating-point number that is equivalent to the number in value, or 0 (zero) if value is null.
String ToBase64String(Byte[],Int32,Int32)
Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. Parameters specify the subset as an offset in the input array, and the number of elements in the array to convert.
ParameterDescription
inArrayAn array of 8-bit unsigned integers.
offsetAn offset in inArray.
lengthThe number of elements of inArray to convert.
Returns: The string representation in base 64 of length elements of inArray, starting at position offset.
String ToBase64String(Byte[])
Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits.
ParameterDescription
inArrayAn array of 8-bit unsigned integers.
Returns: The string representation, in base 64, of the contents of inArray.
byte[] FromBase64String(String)
Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.
ParameterDescription
sThe string to convert.
Returns: An array of 8-bit unsigned integers that is equivalent to s.
int ToBase64CharArray(Byte[],Int32,Int32,Char[],Int32)
Converts a subset of an 8-bit unsigned integer array to an equivalent subset of a Unicode character array encoded with base-64 digits. Parameters specify the subsets as offsets in the input and output arrays, and the number of elements in the input array to convert.
ParameterDescription
inArrayAn input array of 8-bit unsigned integers.
offsetInA position within inArray.
lengthThe number of elements of inArray to convert.
outArrayAn output array of Unicode characters.
offsetOutA position within outArray.
Returns: A 32-bit signed integer containing the number of bytes in outArray.
byte[] FromBase64CharArray(Char[],Int32,Int32)
Converts a subset of a Unicode character array, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array. Parameters specify the subset in the input array and the number of elements to convert.
ParameterDescription
inArrayA Unicode character array.
offsetA position within inArray.
lengthThe number of elements in inArray to convert.
Returns: An array of 8-bit unsigned integers equivalent to length elements at position offset in inArray.
String ToString(Int16,Int32)
Converts the value of a 16-bit signed integer to its equivalent string representation in a specified base.
ParameterDescription
valueThe 16-bit signed integer to convert.
toBaseThe base of the return value, which must be 2, 8, 10, or 16.
Returns: The string representation of value in base toBase.
String ToString(Int32,Int32)
Converts the value of a 32-bit signed integer to its equivalent string representation in a specified base.
ParameterDescription
valueThe 32-bit signed integer to convert.
toBaseThe base of the return value, which must be 2, 8, 10, or 16.
Returns: The string representation of value in base toBase.
String ToString(Int64,Int32)
Converts the value of a 64-bit signed integer to its equivalent string representation in a specified base.
ParameterDescription
valueThe 64-bit signed integer to convert.
toBaseThe base of the return value, which must be 2, 8, 10, or 16.
Returns: The string representation of value in base toBase.
String ToString(Double)
Converts the value of the specified double-precision floating-point number to its equivalent string representation.
ParameterDescription
valueThe double-precision floating-point number to convert.
Returns: The string representation of value.
DateTime ToDateTime(String)
Converts the specified string representation of a date and time to an equivalent date and time value.
ParameterDescription
valueThe string representation of a date and time.
Returns: The date and time equivalent of the value of value, or the date and time equivalent of MinValue if value is null.