Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Convert
Assembly: System.Runtime
Inheritance: object → Convert
Converts a base data type to another base data type.
Fields and Constants
public static readonly
object
DBNull
A constant that represents a database column that is absent of data; that is, database null.
Methods
public static
object
ChangeType​(object value,
Type conversionType)
Returns an object of the specified type and whose value is equivalent to the specified object.
Returns An object whose type is <paramref name="conversionType" /> and whose value is equivalent to <paramref name="value" /> .
-or-
A null reference ( <see langword="Nothing" /> in Visual Basic), if <paramref name="value" /> is <see langword="null" /> and <paramref name="conversionType" /> is not a value type.
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
conversionType
The type of object to return.
public static
object
ChangeType​(object value,
Type conversionType,
IFormatProvider provider)
Returns an object of the specified type whose value is equivalent to the specified object. A parameter supplies culture-specific formatting information.
Returns An object whose type is <paramref name="conversionType" /> and whose value is equivalent to <paramref name="value" /> .
-or-
<paramref name="value" /> , if the <see cref="T:System.Type" /> of <paramref name="value" /> and <paramref name="conversionType" /> are equal.
-or-
A null reference ( <see langword="Nothing" /> in Visual Basic), if <paramref name="value" /> is <see langword="null" /> and <paramref name="conversionType" /> is not a value type.
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
conversionType
The type of object to return.
provider
An object that supplies culture-specific formatting information.
public static
object
ChangeType​(object value,
TypeCode typeCode)
Returns an object of the specified type whose value is equivalent to the specified object.
Returns An object whose underlying type is <paramref name="typeCode" /> and whose value is equivalent to <paramref name="value" /> .
-or-
A null reference ( <see langword="Nothing" /> in Visual Basic), if <paramref name="value" /> is <see langword="null" /> and <paramref name="typeCode" /> is <see cref="F:System.TypeCode.Empty" /> , <see cref="F:System.TypeCode.String" /> , or <see cref="F:System.TypeCode.Object" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
typeCode
The type of object to return.
public static
object
ChangeType​(object value,
TypeCode typeCode,
IFormatProvider provider)
Returns an object of the specified type whose value is equivalent to the specified object. A parameter supplies culture-specific formatting information.
Returns An object whose underlying type is <paramref name="typeCode" /> and whose value is equivalent to <paramref name="value" /> .
-or-
A null reference ( <see langword="Nothing" /> in Visual Basic), if <paramref name="value" /> is <see langword="null" /> and <paramref name="typeCode" /> is <see cref="F:System.TypeCode.Empty" /> , <see cref="F:System.TypeCode.String" /> , or <see cref="F:System.TypeCode.Object" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
typeCode
The type of object to return.
provider
An object that supplies culture-specific formatting information.
public static
byte[]
FromBase64CharArray​(char[] inArray,
int offset,
int length)
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.
Returns An array of 8-bit unsigned integers equivalent to <paramref name="length" /> elements at position <paramref name="offset" /> in <paramref name="inArray" /> .
inArray
A Unicode character array.
offset
A position within <paramref name="inArray" /> .
length
The number of elements in <paramref name="inArray" /> to convert.
public static
byte[]
FromBase64String​(string s)
Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.
Returns An array of 8-bit unsigned integers that is equivalent to <paramref name="s" /> .
s
The string to convert.
public static
byte[]
FromHexString​(ReadOnlySpan<​byte> utf8Source)
Converts the span, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.
Returns An array of 8-bit unsigned integers that is equivalent to <paramref name="utf8Source" /> .
utf8Source
The UTF-8 span to convert.
public static
byte[]
FromHexString​(ReadOnlySpan<​char> chars)
Converts the span, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.
Returns An array of 8-bit unsigned integers that is equivalent to <paramref name="chars" /> .
chars
The span to convert.
public static
OperationStatus
FromHexString​(ReadOnlySpan<​byte> utf8Source,
Span<​byte> destination,
Int32& bytesConsumed,
Int32& bytesWritten)
public static
OperationStatus
FromHexString​(ReadOnlySpan<​char> source,
Span<​byte> destination,
Int32& charsConsumed,
Int32& bytesWritten)
public static
byte[]
FromHexString​(string s)
Converts the specified string, which encodes binary data as hex characters, to an equivalent 8-bit unsigned integer array.
Returns An array of 8-bit unsigned integers that is equivalent to <paramref name="s" /> .
s
The string to convert.
public static
OperationStatus
FromHexString​(string source,
Span<​byte> destination,
Int32& charsConsumed,
Int32& bytesWritten)
public static
TypeCode
GetTypeCode​(object value)
Returns the <see cref="T:System.TypeCode" /> for the specified object.
Returns The <see cref="T:System.TypeCode" /> for <paramref name="value" /> , or <see cref="F:System.TypeCode.Empty" /> if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
public static
bool
IsDBNull​(object value)
Returns an indication whether the specified object is of type <see cref="T:System.DBNull" /> .
Returns <see langword="true" /> if <paramref name="value" /> is of type <see cref="T:System.DBNull" /> ; otherwise, <see langword="false" /> .
value
An object.
public static
int
ToBase64CharArray​(byte[] inArray,
int offsetIn,
int length,
char[] outArray,
int offsetOut)
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.
Returns A 32-bit signed integer containing the number of bytes in <paramref name="outArray" /> .
inArray
An input array of 8-bit unsigned integers.
offsetIn
A position within <paramref name="inArray" /> .
length
The number of elements of <paramref name="inArray" /> to convert.
outArray
An output array of Unicode characters.
offsetOut
A position within <paramref name="outArray" /> .
public static
int
ToBase64CharArray​(byte[] inArray,
int offsetIn,
int length,
char[] outArray,
int offsetOut,
Base64FormattingOptions options)
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, the number of elements in the input array to convert, and whether line breaks are inserted in the output array.
Returns A 32-bit signed integer containing the number of bytes in <paramref name="outArray" /> .
inArray
An input array of 8-bit unsigned integers.
offsetIn
A position within <paramref name="inArray" /> .
length
The number of elements of <paramref name="inArray" /> to convert.
outArray
An output array of Unicode characters.
offsetOut
A position within <paramref name="outArray" /> .
options
<see cref="F:System.Base64FormattingOptions.InsertLineBreaks" /> to insert a line break every 76 characters, or <see cref="F:System.Base64FormattingOptions.None" /> to not insert line breaks.
public static
string
ToBase64String​(byte[] inArray)
Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits.
Returns The string representation, in base 64, of the contents of <paramref name="inArray" /> .
inArray
An array of 8-bit unsigned integers.
public static
string
ToBase64String​(byte[] inArray,
Base64FormattingOptions options)
Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. You can specify whether to insert line breaks in the return value.
Returns The string representation in base 64 of the elements in <paramref name="inArray" /> .
inArray
An array of 8-bit unsigned integers.
options
<see cref="F:System.Base64FormattingOptions.InsertLineBreaks" /> to insert a line break every 76 characters, or <see cref="F:System.Base64FormattingOptions.None" /> to not insert line breaks.
public static
string
ToBase64String​(byte[] inArray,
int offset,
int length)
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.
Returns The string representation in base 64 of <paramref name="length" /> elements of <paramref name="inArray" /> , starting at position <paramref name="offset" /> .
inArray
An array of 8-bit unsigned integers.
offset
An offset in <paramref name="inArray" /> .
length
The number of elements of <paramref name="inArray" /> to convert.
public static
string
ToBase64String​(byte[] inArray,
int offset,
int length,
Base64FormattingOptions options)
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, the number of elements in the array to convert, and whether to insert line breaks in the return value.
Returns The string representation in base 64 of <paramref name="length" /> elements of <paramref name="inArray" /> , starting at position <paramref name="offset" /> .
inArray
An array of 8-bit unsigned integers.
offset
An offset in <paramref name="inArray" /> .
length
The number of elements of <paramref name="inArray" /> to convert.
options
<see cref="F:System.Base64FormattingOptions.InsertLineBreaks" /> to insert a line break every 76 characters, or <see cref="F:System.Base64FormattingOptions.None" /> to not insert line breaks.
public static
string
ToBase64String​(ReadOnlySpan<​byte> bytes,
Base64FormattingOptions options = 0)
Converts the 8-bit unsigned integers inside the specified read-only span into their equivalent string representation that is encoded with base-64 digits. You can optionally specify whether to insert line breaks in the return value.
Returns The string representation in base 64 of the elements in <paramref name="bytes" /> . If the length of <paramref name="bytes" /> is 0, an empty string is returned.
bytes
A read-only span of 8-bit unsigned integers.
options
One of the enumeration values that specify whether to insert line breaks in the return value. The default value is <see cref="F:System.Base64FormattingOptions.None" /> .
public static
bool
ToBoolean​(bool value)
Returns the specified Boolean value; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The Boolean value to return.
public static
bool
ToBoolean​(byte value)
Converts the value of the specified 8-bit unsigned integer to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The 8-bit unsigned integer to convert.
public static
bool
ToBoolean​(char value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The Unicode character to convert.
public static
bool
ToBoolean​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
bool
ToBoolean​(decimal value)
Converts the value of the specified decimal number to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The number to convert.
public static
bool
ToBoolean​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The double-precision floating-point number to convert.
public static
bool
ToBoolean​(short value)
Converts the value of the specified 16-bit signed integer to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The 16-bit signed integer to convert.
public static
bool
ToBoolean​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The 32-bit signed integer to convert.
public static
bool
ToBoolean​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The 64-bit signed integer to convert.
public static
bool
ToBoolean​(object value)
Converts the value of a specified object to an equivalent Boolean value.
Returns <see langword="true" /> or <see langword="false" /> , which reflects the value returned by invoking the <see cref="M:System.IConvertible.ToBoolean(System.IFormatProvider)" /> method for the underlying type of <paramref name="value" /> . If <paramref name="value" /> is <see langword="null" /> , the method returns <see langword="false" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
bool
ToBoolean​(object value,
IFormatProvider provider)
Converts the value of the specified object to an equivalent Boolean value, using the specified culture-specific formatting information.
Returns <see langword="true" /> or <see langword="false" /> , which reflects the value returned by invoking the <see cref="M:System.IConvertible.ToBoolean(System.IFormatProvider)" /> method for the underlying type of <paramref name="value" /> . If <paramref name="value" /> is <see langword="null" /> , the method returns <see langword="false" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
provider
An object that supplies culture-specific formatting information.
public static
bool
ToBoolean​(sbyte value)
Converts the value of the specified 8-bit signed integer to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The 8-bit signed integer to convert.
public static
bool
ToBoolean​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The single-precision floating-point number to convert.
public static
bool
ToBoolean​(string value)
Converts the specified string representation of a logical value to its Boolean equivalent.
Returns <see langword="true" /> if <paramref name="value" /> equals <see cref="F:System.Boolean.TrueString" /> , or <see langword="false" /> if <paramref name="value" /> equals <see cref="F:System.Boolean.FalseString" /> or <see langword="null" /> .
value
A string that contains the value of either <see cref="F:System.Boolean.TrueString" /> or <see cref="F:System.Boolean.FalseString" /> .
public static
bool
ToBoolean​(string value,
IFormatProvider provider)
Converts the specified string representation of a logical value to its Boolean equivalent, using the specified culture-specific formatting information.
Returns <see langword="true" /> if <paramref name="value" /> equals <see cref="F:System.Boolean.TrueString" /> , or <see langword="false" /> if <paramref name="value" /> equals <see cref="F:System.Boolean.FalseString" /> or <see langword="null" /> .
value
A string that contains the value of either <see cref="F:System.Boolean.TrueString" /> or <see cref="F:System.Boolean.FalseString" /> .
provider
An object that supplies culture-specific formatting information. This parameter is ignored.
public static
bool
ToBoolean​(ushort value)
Converts the value of the specified 16-bit unsigned integer to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The 16-bit unsigned integer to convert.
public static
bool
ToBoolean​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The 32-bit unsigned integer to convert.
public static
bool
ToBoolean​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent Boolean value.
Returns <see langword="true" /> if <paramref name="value" /> is not zero; otherwise, <see langword="false" /> .
value
The 64-bit unsigned integer to convert.
public static
byte
ToByte​(bool value)
Converts the specified Boolean value to the equivalent 8-bit unsigned integer.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
byte
ToByte​(byte value)
Returns the specified 8-bit unsigned integer; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The 8-bit unsigned integer to return.
public static
byte
ToByte​(char value)
Converts the value of the specified Unicode character to the equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The Unicode character to convert.
public static
byte
ToByte​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
byte
ToByte​(decimal value)
Converts the value of the specified decimal number to an equivalent 8-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 8-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The number to convert.
public static
byte
ToByte​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent 8-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 8-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The double-precision floating-point number to convert.
public static
byte
ToByte​(short value)
Converts the value of the specified 16-bit signed integer to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
byte
ToByte​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
byte
ToByte​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
byte
ToByte​(object value)
Converts the value of the specified object to an 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
byte
ToByte​(object value,
IFormatProvider provider)
Converts the value of the specified object to an 8-bit unsigned integer, using the specified culture-specific formatting information.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
byte
ToByte​(sbyte value)
Converts the value of the specified 8-bit signed integer to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to be converted.
public static
byte
ToByte​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent 8-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 8-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
A single-precision floating-point number.
public static
byte
ToByte​(string value)
Converts the specified string representation of a number to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
public static
byte
ToByte​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent 8-bit unsigned integer, using specified culture-specific formatting information.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
byte
ToByte​(string value,
int fromBase)
Converts the string representation of a number in a specified base to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
fromBase
The base of the number in <paramref name="value" /> , which must be 2, 8, 10, or 16.
public static
byte
ToByte​(ushort value)
Converts the value of the specified 16-bit unsigned integer to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
byte
ToByte​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
byte
ToByte​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent 8-bit unsigned integer.
Returns An 8-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
char
ToChar​(bool value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The Boolean value to convert.
public static
char
ToChar​(byte value)
Converts the value of the specified 8-bit unsigned integer to its equivalent Unicode character.
Returns A Unicode character that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
char
ToChar​(char value)
Returns the specified Unicode character value; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The Unicode character to return.
public static
char
ToChar​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
char
ToChar​(decimal value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The decimal number to convert.
public static
char
ToChar​(double value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The double-precision floating-point number to convert.
public static
char
ToChar​(short value)
Converts the value of the specified 16-bit signed integer to its equivalent Unicode character.
Returns A Unicode character that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
char
ToChar​(int value)
Converts the value of the specified 32-bit signed integer to its equivalent Unicode character.
Returns A Unicode character that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
char
ToChar​(long value)
Converts the value of the specified 64-bit signed integer to its equivalent Unicode character.
Returns A Unicode character that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
char
ToChar​(object value)
Converts the value of the specified object to a Unicode character.
Returns A Unicode character that is equivalent to value, or <see cref="F:System.Char.MinValue">Char.MinValue</see> if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
public static
char
ToChar​(object value,
IFormatProvider provider)
Converts the value of the specified object to its equivalent Unicode character, using the specified culture-specific formatting information.
Returns A Unicode character that is equivalent to <paramref name="value" /> , or <see cref="F:System.Char.MinValue">Char.MinValue</see> if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
char
ToChar​(sbyte value)
Converts the value of the specified 8-bit signed integer to its equivalent Unicode character.
Returns A Unicode character that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
char
ToChar​(Single value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The single-precision floating-point number to convert.
public static
char
ToChar​(string value)
Converts the first character of a specified string to a Unicode character.
Returns A Unicode character that is equivalent to the first and only character in <paramref name="value" /> .
value
A string of length 1.
public static
char
ToChar​(string value,
IFormatProvider? provider)
Converts the first character of a specified string to a Unicode character, using specified culture-specific formatting information.
Returns A Unicode character that is equivalent to the first and only character in <paramref name="value" /> .
value
A string of length 1 or <see langword="null" /> .
provider
An object that supplies culture-specific formatting information. This parameter is ignored.
public static
char
ToChar​(ushort value)
Converts the value of the specified 16-bit unsigned integer to its equivalent Unicode character.
Returns A Unicode character that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
char
ToChar​(uint value)
Converts the value of the specified 32-bit unsigned integer to its equivalent Unicode character.
Returns A Unicode character that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
char
ToChar​(ulong value)
Converts the value of the specified 64-bit unsigned integer to its equivalent Unicode character.
Returns A Unicode character that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
DateTime
ToDateTime​(bool value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The Boolean value to convert.
public static
DateTime
ToDateTime​(byte value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The 8-bit unsigned integer to convert.
public static
DateTime
ToDateTime​(char value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The Unicode character to convert.
public static
DateTime
ToDateTime​(DateTime value)
Returns the specified <see cref="T:System.DateTime" /> object; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
A date and time value.
public static
DateTime
ToDateTime​(decimal value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The number to convert.
public static
DateTime
ToDateTime​(double value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The double-precision floating-point value to convert.
public static
DateTime
ToDateTime​(short value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The 16-bit signed integer to convert.
public static
DateTime
ToDateTime​(int value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The 32-bit signed integer to convert.
public static
DateTime
ToDateTime​(long value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The 64-bit signed integer to convert.
public static
DateTime
ToDateTime​(object value)
Converts the value of the specified object to a <see cref="T:System.DateTime" /> object.
Returns The date and time equivalent of the value of <paramref name="value" /> , or a date and time equivalent of <see cref="F:System.DateTime.MinValue">DateTime.MinValue</see> if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
DateTime
ToDateTime​(object value,
IFormatProvider provider)
Converts the value of the specified object to a <see cref="T:System.DateTime" /> object, using the specified culture-specific formatting information.
Returns The date and time equivalent of the value of <paramref name="value" /> , or the date and time equivalent of <see cref="F:System.DateTime.MinValue">DateTime.MinValue</see> if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
DateTime
ToDateTime​(sbyte value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The 8-bit signed integer to convert.
public static
DateTime
ToDateTime​(Single value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The single-precision floating-point value to convert.
public static
DateTime
ToDateTime​(string value)
Converts the specified string representation of a date and time to an equivalent date and time value.
Returns The date and time equivalent of the value of <paramref name="value" /> , or the date and time equivalent of <see cref="F:System.DateTime.MinValue">DateTime.MinValue</see> if <paramref name="value" /> is <see langword="null" /> .
value
The string representation of a date and time.
public static
DateTime
ToDateTime​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent date and time, using the specified culture-specific formatting information.
Returns The date and time equivalent of the value of <paramref name="value" /> , or the date and time equivalent of <see cref="F:System.DateTime.MinValue">DateTime.MinValue</see> if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains a date and time to convert.
provider
An object that supplies culture-specific formatting information.
public static
DateTime
ToDateTime​(ushort value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The 16-bit unsigned integer to convert.
public static
DateTime
ToDateTime​(uint value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The 32-bit unsigned integer to convert.
public static
DateTime
ToDateTime​(ulong value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The 64-bit unsigned integer to convert.
public static
decimal
ToDecimal​(bool value)
Converts the specified Boolean value to the equivalent decimal number.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
decimal
ToDecimal​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent decimal number.
Returns The decimal number that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
decimal
ToDecimal​(char value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The Unicode character to convert.
public static
decimal
ToDecimal​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
decimal
ToDecimal​(decimal value)
Returns the specified decimal number; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
A decimal number.
public static
decimal
ToDecimal​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> .
value
The double-precision floating-point number to convert.
public static
decimal
ToDecimal​(short value)
Converts the value of the specified 16-bit signed integer to an equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
decimal
ToDecimal​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
decimal
ToDecimal​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
decimal
ToDecimal​(object value)
Converts the value of the specified object to an equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
decimal
ToDecimal​(object value,
IFormatProvider provider)
Converts the value of the specified object to an equivalent decimal number, using the specified culture-specific formatting information.
Returns A decimal number that is equivalent to <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
decimal
ToDecimal​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
decimal
ToDecimal​(Single value)
Converts the value of the specified single-precision floating-point number to the equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> .
value
The single-precision floating-point number to convert.
public static
decimal
ToDecimal​(string value)
Converts the specified string representation of a number to an equivalent decimal number.
Returns A decimal number that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains a number to convert.
public static
decimal
ToDecimal​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent decimal number, using the specified culture-specific formatting information.
Returns A decimal number that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains a number to convert.
provider
An object that supplies culture-specific formatting information.
public static
decimal
ToDecimal​(ushort value)
Converts the value of the specified 16-bit unsigned integer to an equivalent decimal number.
Returns The decimal number that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
decimal
ToDecimal​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
decimal
ToDecimal​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent decimal number.
Returns A decimal number that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
double
ToDouble​(bool value)
Converts the specified Boolean value to the equivalent double-precision floating-point number.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
double
ToDouble​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent double-precision floating-point number.
Returns The double-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
double
ToDouble​(char value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The Unicode character to convert.
public static
double
ToDouble​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
double
ToDouble​(decimal value)
Converts the value of the specified decimal number to an equivalent double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The decimal number to convert.
public static
double
ToDouble​(double value)
Returns the specified double-precision floating-point number; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The double-precision floating-point number to return.
public static
double
ToDouble​(short value)
Converts the value of the specified 16-bit signed integer to an equivalent double-precision floating-point number.
Returns A double-precision floating-point number equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
double
ToDouble​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
double
ToDouble​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
double
ToDouble​(object value)
Converts the value of the specified object to a double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
double
ToDouble​(object value,
IFormatProvider provider)
Converts the value of the specified object to an double-precision floating-point number, using the specified culture-specific formatting information.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
double
ToDouble​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent double-precision floating-point number.
Returns The 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
double
ToDouble​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The single-precision floating-point number.
public static
double
ToDouble​(string value)
Converts the specified string representation of a number to an equivalent double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
public static
double
ToDouble​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent double-precision floating-point number, using the specified culture-specific formatting information.
Returns A double-precision floating-point number that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
double
ToDouble​(ushort value)
Converts the value of the specified 16-bit unsigned integer to the equivalent double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
double
ToDouble​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
double
ToDouble​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent double-precision floating-point number.
Returns A double-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
string
ToHexString​(byte[] inArray)
Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with uppercase hex characters.
Returns The string representation in hex of the elements in <paramref name="inArray" /> .
inArray
An array of 8-bit unsigned integers.
public static
string
ToHexString​(byte[] inArray,
int offset,
int length)
Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with uppercase hex characters.
Parameters specify the subset as an offset in the input array and the number of elements in the array to convert.
Returns The string representation in hex of <paramref name="length" /> elements of <paramref name="inArray" /> , starting at position <paramref name="offset" /> .
inArray
An array of 8-bit unsigned integers.
offset
An offset in <paramref name="inArray" /> .
length
The number of elements of <paramref name="inArray" /> to convert.
public static
string
ToHexString​(ReadOnlySpan<​byte> bytes)
Converts a span of 8-bit unsigned integers to its equivalent string representation that is encoded with uppercase hex characters.
Returns The string representation in hex of the elements in <paramref name="bytes" /> .
bytes
A span of 8-bit unsigned integers.
public static
string
ToHexStringLower​(byte[] inArray)
Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with lowercase hex characters.
Returns The string representation in hex of the elements in <paramref name="inArray" /> .
inArray
An array of 8-bit unsigned integers.
public static
string
ToHexStringLower​(byte[] inArray,
int offset,
int length)
Converts a subset of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with lowercase hex characters.
Parameters specify the subset as an offset in the input array and the number of elements in the array to convert.
Returns The string representation in hex of <paramref name="length" /> elements of <paramref name="inArray" /> , starting at position <paramref name="offset" /> .
inArray
An array of 8-bit unsigned integers.
offset
An offset in <paramref name="inArray" /> .
length
The number of elements of <paramref name="inArray" /> to convert.
public static
string
ToHexStringLower​(ReadOnlySpan<​byte> bytes)
Converts a span of 8-bit unsigned integers to its equivalent string representation that is encoded with lowercase hex characters.
Returns The string representation in hex of the elements in <paramref name="bytes" /> .
bytes
A span of 8-bit unsigned integers.
public static
short
ToInt16​(bool value)
Converts the specified Boolean value to the equivalent 16-bit signed integer.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
short
ToInt16​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
short
ToInt16​(char value)
Converts the value of the specified Unicode character to the equivalent 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to <paramref name="value" /> .
value
The Unicode character to convert.
public static
short
ToInt16​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
short
ToInt16​(decimal value)
Converts the value of the specified decimal number to an equivalent 16-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 16-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The decimal number to convert.
public static
short
ToInt16​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent 16-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 16-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The double-precision floating-point number to convert.
public static
short
ToInt16​(short value)
Returns the specified 16-bit signed integer; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The 16-bit signed integer to return.
public static
short
ToInt16​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent 16-bit signed integer.
Returns The 16-bit signed integer equivalent of <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
short
ToInt16​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
short
ToInt16​(object value)
Converts the value of the specified object to a 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
short
ToInt16​(object value,
IFormatProvider provider)
Converts the value of the specified object to a 16-bit signed integer, using the specified culture-specific formatting information.
Returns A 16-bit signed integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
short
ToInt16​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent 16-bit signed integer.
Returns A 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
short
ToInt16​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent 16-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 16-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The single-precision floating-point number to convert.
public static
short
ToInt16​(string value)
Converts the specified string representation of a number to an equivalent 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
public static
short
ToInt16​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent 16-bit signed integer, using the specified culture-specific formatting information.
Returns A 16-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
short
ToInt16​(string value,
int fromBase)
Converts the string representation of a number in a specified base to an equivalent 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
fromBase
The base of the number in <paramref name="value" /> , which must be 2, 8, 10, or 16.
public static
short
ToInt16​(ushort value)
Converts the value of the specified 16-bit unsigned integer to the equivalent 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
short
ToInt16​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
short
ToInt16​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent 16-bit signed integer.
Returns A 16-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
int
ToInt32​(bool value)
Converts the specified Boolean value to the equivalent 32-bit signed integer.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
int
ToInt32​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
int
ToInt32​(char value)
Converts the value of the specified Unicode character to the equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to <paramref name="value" /> .
value
The Unicode character to convert.
public static
int
ToInt32​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
int
ToInt32​(decimal value)
Converts the value of the specified decimal number to an equivalent 32-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 32-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The decimal number to convert.
public static
int
ToInt32​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent 32-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 32-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The double-precision floating-point number to convert.
public static
int
ToInt32​(short value)
Converts the value of the specified 16-bit signed integer to an equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
int
ToInt32​(int value)
Returns the specified 32-bit signed integer; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The 32-bit signed integer to return.
public static
int
ToInt32​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
int
ToInt32​(object value)
Converts the value of the specified object to a 32-bit signed integer.
Returns A 32-bit signed integer equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
int
ToInt32​(object value,
IFormatProvider provider)
Converts the value of the specified object to a 32-bit signed integer, using the specified culture-specific formatting information.
Returns A 32-bit signed integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
int
ToInt32​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent 32-bit signed integer.
Returns A 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
int
ToInt32​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent 32-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 32-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The single-precision floating-point number to convert.
public static
int
ToInt32​(string value)
Converts the specified string representation of a number to an equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
public static
int
ToInt32​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent 32-bit signed integer, using the specified culture-specific formatting information.
Returns A 32-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
int
ToInt32​(string value,
int fromBase)
Converts the string representation of a number in a specified base to an equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
fromBase
The base of the number in <paramref name="value" /> , which must be 2, 8, 10, or 16.
public static
int
ToInt32​(ushort value)
Converts the value of the specified 16-bit unsigned integer to the equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
int
ToInt32​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
int
ToInt32​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent 32-bit signed integer.
Returns A 32-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
long
ToInt64​(bool value)
Converts the specified Boolean value to the equivalent 64-bit signed integer.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
long
ToInt64​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
long
ToInt64​(char value)
Converts the value of the specified Unicode character to the equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The Unicode character to convert.
public static
long
ToInt64​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
long
ToInt64​(decimal value)
Converts the value of the specified decimal number to an equivalent 64-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 64-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The decimal number to convert.
public static
long
ToInt64​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent 64-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 64-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The double-precision floating-point number to convert.
public static
long
ToInt64​(short value)
Converts the value of the specified 16-bit signed integer to an equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
long
ToInt64​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
long
ToInt64​(long value)
Returns the specified 64-bit signed integer; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
A 64-bit signed integer.
public static
long
ToInt64​(object value)
Converts the value of the specified object to a 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
long
ToInt64​(object value,
IFormatProvider provider)
Converts the value of the specified object to a 64-bit signed integer, using the specified culture-specific formatting information.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
long
ToInt64​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
long
ToInt64​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent 64-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 64-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The single-precision floating-point number to convert.
public static
long
ToInt64​(string value)
Converts the specified string representation of a number to an equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains a number to convert.
public static
long
ToInt64​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent 64-bit signed integer, using the specified culture-specific formatting information.
Returns A 64-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
long
ToInt64​(string value,
int fromBase)
Converts the string representation of a number in a specified base to an equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
fromBase
The base of the number in <paramref name="value" /> , which must be 2, 8, 10, or 16.
public static
long
ToInt64​(ushort value)
Converts the value of the specified 16-bit unsigned integer to the equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
long
ToInt64​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
long
ToInt64​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent 64-bit signed integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
sbyte
ToSByte​(bool value)
Converts the specified Boolean value to the equivalent 8-bit signed integer.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
sbyte
ToSByte​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
sbyte
ToSByte​(char value)
Converts the value of the specified Unicode character to the equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The Unicode character to convert.
public static
sbyte
ToSByte​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
sbyte
ToSByte​(decimal value)
Converts the value of the specified decimal number to an equivalent 8-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 8-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The decimal number to convert.
public static
sbyte
ToSByte​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent 8-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 8-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The double-precision floating-point number to convert.
public static
sbyte
ToSByte​(short value)
Converts the value of the specified 16-bit signed integer to the equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
sbyte
ToSByte​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
sbyte
ToSByte​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
sbyte
ToSByte​(object value)
Converts the value of the specified object to an 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
sbyte
ToSByte​(object value,
IFormatProvider provider)
Converts the value of the specified object to an 8-bit signed integer, using the specified culture-specific formatting information.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
sbyte
ToSByte​(sbyte value)
Returns the specified 8-bit signed integer; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The 8-bit signed integer to return.
public static
sbyte
ToSByte​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent 8-bit signed integer.
Returns <paramref name="value" /> , rounded to the nearest 8-bit signed integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The single-precision floating-point number to convert.
public static
sbyte
ToSByte​(string value)
Converts the specified string representation of a number to an equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if value is <see langword="null" /> .
value
A string that contains the number to convert.
public static
sbyte
ToSByte​(string value,
IFormatProvider? provider)
Converts the specified string representation of a number to an equivalent 8-bit signed integer, using the specified culture-specific formatting information.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
sbyte
ToSByte​(string value,
int fromBase)
Converts the string representation of a number in a specified base to an equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
fromBase
The base of the number in <paramref name="value" /> , which must be 2, 8, 10, or 16.
public static
sbyte
ToSByte​(ushort value)
Converts the value of the specified 16-bit unsigned integer to the equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
sbyte
ToSByte​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
sbyte
ToSByte​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent 8-bit signed integer.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
Single
ToSingle​(bool value)
Converts the specified Boolean value to the equivalent single-precision floating-point number.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
Single
ToSingle​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
Single
ToSingle​(char value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The Unicode character to convert.
public static
Single
ToSingle​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
Single
ToSingle​(decimal value)
Converts the value of the specified decimal number to an equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
<paramref name="value" /> is rounded using rounding to nearest. For example, when rounded to two decimals, the value 2.345 becomes 2.34 and the value 2.355 becomes 2.36.
value
The decimal number to convert.
public static
Single
ToSingle​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
<paramref name="value" /> is rounded using rounding to nearest. For example, when rounded to two decimals, the value 2.345 becomes 2.34 and the value 2.355 becomes 2.36.
value
The double-precision floating-point number to convert.
public static
Single
ToSingle​(short value)
Converts the value of the specified 16-bit signed integer to an equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
Single
ToSingle​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
Single
ToSingle​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
Single
ToSingle​(object value)
Converts the value of the specified object to a single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
Single
ToSingle​(object value,
IFormatProvider provider)
Converts the value of the specified object to an single-precision floating-point number, using the specified culture-specific formatting information.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
Single
ToSingle​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent single-precision floating-point number.
Returns An 8-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
Single
ToSingle​(Single value)
Returns the specified single-precision floating-point number; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The single-precision floating-point number to return.
public static
Single
ToSingle​(string value)
Converts the specified string representation of a number to an equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
public static
Single
ToSingle​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent single-precision floating-point number, using the specified culture-specific formatting information.
Returns A single-precision floating-point number that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
Single
ToSingle​(ushort value)
Converts the value of the specified 16-bit unsigned integer to the equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
Single
ToSingle​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
Single
ToSingle​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent single-precision floating-point number.
Returns A single-precision floating-point number that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
string
ToString​(bool value)
Converts the specified Boolean value to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The Boolean value to convert.
public static
string
ToString​(bool value,
IFormatProvider? provider)
Converts the specified Boolean value to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The Boolean value to convert.
provider
An instance of an object. This parameter is ignored.
public static
string
ToString​(byte value)
Converts the value of the specified 8-bit unsigned integer to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
string
ToString​(byte value,
IFormatProvider? provider)
Converts the value of the specified 8-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(byte value,
int toBase)
Converts the value of an 8-bit unsigned integer to its equivalent string representation in a specified base.
Returns The string representation of <paramref name="value" /> in base <paramref name="toBase" /> .
value
The 8-bit unsigned integer to convert.
toBase
The base of the return value, which must be 2, 8, 10, or 16.
public static
string
ToString​(char value)
Converts the value of the specified Unicode character to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The Unicode character to convert.
public static
string
ToString​(char value,
IFormatProvider? provider)
Converts the value of the specified Unicode character to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The Unicode character to convert.
provider
An object that supplies culture-specific formatting information. This parameter is ignored.
public static
string
ToString​(DateTime value)
Converts the value of the specified <see cref="T:System.DateTime" /> to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The date and time value to convert.
public static
string
ToString​(DateTime value,
IFormatProvider? provider)
Converts the value of the specified <see cref="T:System.DateTime" /> to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The date and time value to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(decimal value)
Converts the value of the specified decimal number to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The decimal number to convert.
public static
string
ToString​(decimal value,
IFormatProvider? provider)
Converts the value of the specified decimal number to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The decimal number to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(double value)
Converts the value of the specified double-precision floating-point number to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The double-precision floating-point number to convert.
public static
string
ToString​(double value,
IFormatProvider? provider)
Converts the value of the specified double-precision floating-point number to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The double-precision floating-point number to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(short value)
Converts the value of the specified 16-bit signed integer to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
string
ToString​(short value,
IFormatProvider? provider)
Converts the value of the specified 16-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The 16-bit signed integer to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(short value,
int toBase)
Converts the value of a 16-bit signed integer to its equivalent string representation in a specified base.
Returns The string representation of <paramref name="value" /> in base <paramref name="toBase" /> .
value
The 16-bit signed integer to convert.
toBase
The base of the return value, which must be 2, 8, 10, or 16.
public static
string
ToString​(int value)
Converts the value of the specified 32-bit signed integer to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
string
ToString​(int value,
IFormatProvider? provider)
Converts the value of the specified 32-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The 32-bit signed integer to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(int value,
int toBase)
Converts the value of a 32-bit signed integer to its equivalent string representation in a specified base.
Returns The string representation of <paramref name="value" /> in base <paramref name="toBase" /> .
value
The 32-bit signed integer to convert.
toBase
The base of the return value, which must be 2, 8, 10, or 16.
public static
string
ToString​(long value)
Converts the value of the specified 64-bit signed integer to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
string
ToString​(long value,
IFormatProvider? provider)
Converts the value of the specified 64-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The 64-bit signed integer to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(long value,
int toBase)
Converts the value of a 64-bit signed integer to its equivalent string representation in a specified base.
Returns The string representation of <paramref name="value" /> in base <paramref name="toBase" /> .
value
The 64-bit signed integer to convert.
toBase
The base of the return value, which must be 2, 8, 10, or 16.
public static
string
ToString​(object value)
Converts the value of the specified object to its equivalent string representation.
Returns The string representation of <paramref name="value" /> , or <see cref="F:System.String.Empty" /> if <paramref name="value" /> is <see langword="null" /> .
value
An object that supplies the value to convert, or <see langword="null" /> .
public static
string
ToString​(object value,
IFormatProvider provider)
Converts the value of the specified object to its equivalent string representation using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> , or <see cref="F:System.String.Empty" /> if <paramref name="value" /> is an object whose value is <see langword="null" /> . If <paramref name="value" /> is <see langword="null" /> , the method returns <see langword="null" /> .
value
An object that supplies the value to convert, or <see langword="null" /> .
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(sbyte value)
Converts the value of the specified 8-bit signed integer to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
string
ToString​(sbyte value,
IFormatProvider? provider)
Converts the value of the specified 8-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The 8-bit signed integer to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(Single value)
Converts the value of the specified single-precision floating-point number to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The single-precision floating-point number to convert.
public static
string
ToString​(Single value,
IFormatProvider? provider)
Converts the value of the specified single-precision floating-point number to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The single-precision floating-point number to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(string value)
Returns the specified string instance; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The string to return.
public static
string
ToString​(string value,
IFormatProvider provider)
Returns the specified string instance; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The string to return.
provider
An object that supplies culture-specific formatting information. This parameter is ignored.
public static
string
ToString​(ushort value)
Converts the value of the specified 16-bit unsigned integer to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
string
ToString​(ushort value,
IFormatProvider? provider)
Converts the value of the specified 16-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(uint value)
Converts the value of the specified 32-bit unsigned integer to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
string
ToString​(uint value,
IFormatProvider? provider)
Converts the value of the specified 32-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
provider
An object that supplies culture-specific formatting information.
public static
string
ToString​(ulong value)
Converts the value of the specified 64-bit unsigned integer to its equivalent string representation.
Returns The string representation of <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
string
ToString​(ulong value,
IFormatProvider? provider)
Converts the value of the specified 64-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information.
Returns The string representation of <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
provider
An object that supplies culture-specific formatting information.
public static
ushort
ToUInt16​(bool value)
Converts the specified Boolean value to the equivalent 16-bit unsigned integer.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
ushort
ToUInt16​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
ushort
ToUInt16​(char value)
Converts the value of the specified Unicode character to the equivalent 16-bit unsigned integer.
Returns The 16-bit unsigned integer equivalent to <paramref name="value" /> .
value
The Unicode character to convert.
public static
ushort
ToUInt16​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
ushort
ToUInt16​(decimal value)
Converts the value of the specified decimal number to an equivalent 16-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 16-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The decimal number to convert.
public static
ushort
ToUInt16​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent 16-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 16-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The double-precision floating-point number to convert.
public static
ushort
ToUInt16​(short value)
Converts the value of the specified 16-bit signed integer to the equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
ushort
ToUInt16​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
ushort
ToUInt16​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
ushort
ToUInt16​(object value)
Converts the value of the specified object to a 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
ushort
ToUInt16​(object value,
IFormatProvider provider)
Converts the value of the specified object to a 16-bit unsigned integer, using the specified culture-specific formatting information.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
ushort
ToUInt16​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
ushort
ToUInt16​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent 16-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 16-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The single-precision floating-point number to convert.
public static
ushort
ToUInt16​(string value)
Converts the specified string representation of a number to an equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
public static
ushort
ToUInt16​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent 16-bit unsigned integer, using the specified culture-specific formatting information.
Returns A 16-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
ushort
ToUInt16​(string value,
int fromBase)
Converts the string representation of a number in a specified base to an equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
fromBase
The base of the number in <paramref name="value" /> , which must be 2, 8, 10, or 16.
public static
ushort
ToUInt16​(ushort value)
Returns the specified 16-bit unsigned integer; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The 16-bit unsigned integer to return.
public static
ushort
ToUInt16​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
ushort
ToUInt16​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent 16-bit unsigned integer.
Returns A 16-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
uint
ToUInt32​(bool value)
Converts the specified Boolean value to the equivalent 32-bit unsigned integer.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
uint
ToUInt32​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
uint
ToUInt32​(char value)
Converts the value of the specified Unicode character to the equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The Unicode character to convert.
public static
uint
ToUInt32​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
uint
ToUInt32​(decimal value)
Converts the value of the specified decimal number to an equivalent 32-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 32-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The decimal number to convert.
public static
uint
ToUInt32​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent 32-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 32-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The double-precision floating-point number to convert.
public static
uint
ToUInt32​(short value)
Converts the value of the specified 16-bit signed integer to the equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
uint
ToUInt32​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
uint
ToUInt32​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
uint
ToUInt32​(object value)
Converts the value of the specified object to a 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
uint
ToUInt32​(object value,
IFormatProvider provider)
Converts the value of the specified object to a 32-bit unsigned integer, using the specified culture-specific formatting information.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
uint
ToUInt32​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
uint
ToUInt32​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent 32-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 32-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The single-precision floating-point number to convert.
public static
uint
ToUInt32​(string value)
Converts the specified string representation of a number to an equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
public static
uint
ToUInt32​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent 32-bit unsigned integer, using the specified culture-specific formatting information.
Returns A 32-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
uint
ToUInt32​(string value,
int fromBase)
Converts the string representation of a number in a specified base to an equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
fromBase
The base of the number in <paramref name="value" /> , which must be 2, 8, 10, or 16.
public static
uint
ToUInt32​(ushort value)
Converts the value of the specified 16-bit unsigned integer to the equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
uint
ToUInt32​(uint value)
Returns the specified 32-bit unsigned integer; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The 32-bit unsigned integer to return.
public static
uint
ToUInt32​(ulong value)
Converts the value of the specified 64-bit unsigned integer to an equivalent 32-bit unsigned integer.
Returns A 32-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 64-bit unsigned integer to convert.
public static
ulong
ToUInt64​(bool value)
Converts the specified Boolean value to the equivalent 64-bit unsigned integer.
Returns The number 1 if <paramref name="value" /> is <see langword="true" /> ; otherwise, 0.
value
The Boolean value to convert.
public static
ulong
ToUInt64​(byte value)
Converts the value of the specified 8-bit unsigned integer to the equivalent 64-bit unsigned integer.
Returns A 64-bit signed integer that is equivalent to <paramref name="value" /> .
value
The 8-bit unsigned integer to convert.
public static
ulong
ToUInt64​(char value)
Converts the value of the specified Unicode character to the equivalent 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The Unicode character to convert.
public static
ulong
ToUInt64​(DateTime value)
Calling this method always throws <see cref="T:System.InvalidCastException" /> .
Returns This conversion is not supported. No value is returned.
value
The date and time value to convert.
public static
ulong
ToUInt64​(decimal value)
Converts the value of the specified decimal number to an equivalent 64-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 64-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The decimal number to convert.
public static
ulong
ToUInt64​(double value)
Converts the value of the specified double-precision floating-point number to an equivalent 64-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 64-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The double-precision floating-point number to convert.
public static
ulong
ToUInt64​(short value)
Converts the value of the specified 16-bit signed integer to the equivalent 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 16-bit signed integer to convert.
public static
ulong
ToUInt64​(int value)
Converts the value of the specified 32-bit signed integer to an equivalent 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 32-bit signed integer to convert.
public static
ulong
ToUInt64​(long value)
Converts the value of the specified 64-bit signed integer to an equivalent 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 64-bit signed integer to convert.
public static
ulong
ToUInt64​(object value)
Converts the value of the specified object to a 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface, or <see langword="null" /> .
public static
ulong
ToUInt64​(object value,
IFormatProvider provider)
Converts the value of the specified object to a 64-bit unsigned integer, using the specified culture-specific formatting information.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> , or zero if <paramref name="value" /> is <see langword="null" /> .
value
An object that implements the <see cref="T:System.IConvertible" /> interface.
provider
An object that supplies culture-specific formatting information.
public static
ulong
ToUInt64​(sbyte value)
Converts the value of the specified 8-bit signed integer to the equivalent 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 8-bit signed integer to convert.
public static
ulong
ToUInt64​(Single value)
Converts the value of the specified single-precision floating-point number to an equivalent 64-bit unsigned integer.
Returns <paramref name="value" /> , rounded to the nearest 64-bit unsigned integer. If <paramref name="value" /> is halfway between two whole numbers, the even number is returned; that is, 4.5 is converted to 4, and 5.5 is converted to 6.
value
The single-precision floating-point number to convert.
public static
ulong
ToUInt64​(string value)
Converts the specified string representation of a number to an equivalent 64-bit unsigned integer.
Returns A 64-bit signed integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
public static
ulong
ToUInt64​(string value,
IFormatProvider provider)
Converts the specified string representation of a number to an equivalent 64-bit unsigned integer, using the specified culture-specific formatting information.
Returns A 64-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
provider
An object that supplies culture-specific formatting information.
public static
ulong
ToUInt64​(string value,
int fromBase)
Converts the string representation of a number in a specified base to an equivalent 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to the number in <paramref name="value" /> , or 0 (zero) if <paramref name="value" /> is <see langword="null" /> .
value
A string that contains the number to convert.
fromBase
The base of the number in <paramref name="value" /> , which must be 2, 8, 10, or 16.
public static
ulong
ToUInt64​(ushort value)
Converts the value of the specified 16-bit unsigned integer to the equivalent 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 16-bit unsigned integer to convert.
public static
ulong
ToUInt64​(uint value)
Converts the value of the specified 32-bit unsigned integer to an equivalent 64-bit unsigned integer.
Returns A 64-bit unsigned integer that is equivalent to <paramref name="value" /> .
value
The 32-bit unsigned integer to convert.
public static
ulong
ToUInt64​(ulong value)
Returns the specified 64-bit unsigned integer; no actual conversion is performed.
Returns <paramref name="value" /> is returned unchanged.
value
The 64-bit unsigned integer to return.
public static
bool
TryFromBase64Chars​(ReadOnlySpan<​char> chars,
Span<​byte> bytes,
Int32& bytesWritten)
public static
bool
TryFromBase64String​(string s,
Span<​byte> bytes,
Int32& bytesWritten)
public static
bool
TryToBase64Chars​(ReadOnlySpan<​byte> bytes,
Span<​char> chars,
Int32& charsWritten,
Base64FormattingOptions options = 0)
public static
bool
TryToHexString​(ReadOnlySpan<​byte> source,
Span<​byte> utf8Destination,
Int32& bytesWritten)
public static
bool
TryToHexString​(ReadOnlySpan<​byte> source,
Span<​char> destination,
Int32& charsWritten)
public static
bool
TryToHexStringLower​(ReadOnlySpan<​byte> source,
Span<​byte> utf8Destination,
Int32& bytesWritten)
public static
bool
TryToHexStringLower​(ReadOnlySpan<​byte> source,
Span<​char> destination,
Int32& charsWritten)
public
bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj
The object to compare with the current object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public
Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.