Convert 类

定义

将一个基本数据类型转换为另一个基本数据类型。Converts a base data type to another base data type.

public ref class Convert abstract sealed
public static class Convert
type Convert = class
Public Class Convert
继承
Convert

示例

下面Convert的示例演示类中的一些转换方法,包括ToInt32ToBooleanToStringThe following example demonstrates some of the conversion methods in the Convert class, including ToInt32, ToBoolean, and ToString.

Double dNumber = 23.15;

try
{
   // Returns 23
   Int32 iNumber = Convert::ToInt32( dNumber );
}
catch ( OverflowException^ ) 
{
   Console::WriteLine(
      "Overflow in Double to Int32 conversion" );
}
// Returns True
Boolean bNumber = Convert::ToBoolean( dNumber );

// Returns "23.15"
String^ strNumber = Convert::ToString( dNumber );

try
{
   // Returns '2'
   Char chrNumber = Convert::ToChar( strNumber->Substring( 0, 1 ) );
}
catch ( ArgumentNullException^ ) 
{
   Console::WriteLine(  "String is null" );
}
catch ( FormatException^ ) 
{
   Console::WriteLine(  "String length is greater than 1" );
}

// System::Console::ReadLine() returns a string and it
// must be converted.
Int32 newInteger = 0;
try
{
   Console::WriteLine(  "Enter an integer:" );
   newInteger = Convert::ToInt32( System::Console::ReadLine() );
}
catch ( ArgumentNullException^ ) 
{
   Console::WriteLine(  "String is null" );
}
catch ( FormatException^ ) 
{
   Console::WriteLine(  "String does not consist of an " +
      "optional sign followed by a series of digits" );
}
catch ( OverflowException^ ) 
{
   Console::WriteLine(  "Overflow in string to Int32 conversion" );
}

Console::WriteLine( "Your integer as a Double is {0}",
   Convert::ToDouble( newInteger ) );
double dNumber = 23.15;

try {
    // Returns 23
    int    iNumber = System.Convert.ToInt32(dNumber);
}
catch (System.OverflowException) {
    System.Console.WriteLine(
                "Overflow in double to int conversion.");
}
// Returns True
bool   bNumber = System.Convert.ToBoolean(dNumber);

// Returns "23.15"
string strNumber = System.Convert.ToString(dNumber);

try {
    // Returns '2'
    char chrNumber = System.Convert.ToChar(strNumber[0]);
} 
catch (System.ArgumentNullException) {
    System.Console.WriteLine("String is null");
}
catch (System.FormatException) {
    System.Console.WriteLine("String length is greater than 1.");
}

// System.Console.ReadLine() returns a string and it
// must be converted.
int newInteger = 0;
try {
    System.Console.WriteLine("Enter an integer:");
    newInteger = System.Convert.ToInt32(
                        System.Console.ReadLine());
}
catch (System.ArgumentNullException) {
    System.Console.WriteLine("String is null.");
}
catch (System.FormatException) {
    System.Console.WriteLine("String does not consist of an " +
                    "optional sign followed by a series of digits.");
} 
catch (System.OverflowException) {
    System.Console.WriteLine(
    "Overflow in string to int conversion.");
}

System.Console.WriteLine("Your integer as a double is {0}",
                         System.Convert.ToDouble(newInteger));
Dim dNumber As Double
dNumber = 23.15

Try
   ' Returns 23
   Dim iNumber As Integer
   iNumber = System.Convert.ToInt32(dNumber)
Catch exp As System.OverflowException
   System.Console.WriteLine("Overflow in double to int conversion.")
End Try

' Returns True
Dim bNumber As Boolean
bNumber = System.Convert.ToBoolean(dNumber)

' Returns "23.15"
Dim strNumber As String
strNumber = System.Convert.ToString(dNumber)

Try
   ' Returns '2'
   Dim chrNumber As Char
   chrNumber = System.Convert.ToChar(strNumber.Chars(1))
Catch exp As System.ArgumentNullException
   System.Console.WriteLine("String is null.")
Catch exp As System.FormatException
   System.Console.WriteLine("String length is greater than 1.")
End Try

' System.Console.ReadLine() returns a string and it
' must be converted.
Dim newInteger As Integer
newInteger = 0
Try
   System.Console.WriteLine("Enter an integer:")
   newInteger = System.Convert.ToInt32(System.Console.ReadLine())
Catch exp As System.ArgumentNullException
   System.Console.WriteLine("String is null.")
Catch exp As System.FormatException
   System.Console.WriteLine("String does not consist of an " + _
       "optional sign followed by a series of digits.")
Catch exp As System.OverflowException
   System.Console.WriteLine("Overflow in string to int conversion.")
End Try

System.Console.WriteLine("Your integer as a double is {0}", _
                         System.Convert.ToDouble(newInteger))

注解

Convert类的静态方法主要用于支持与 .NET Framework 中的基本数据类型之间的转换。The static methods of the Convert class are primarily used to support conversion to and from the base data types in the .NET Framework. 支持的基类型为BooleanCharSByte Byte、、 Int16Int32Int64 、、UInt32、 、、、UInt64 UInt16 Single DoubleDecimalDateTime和。StringThe supported base types are Boolean, Char, SByte, Byte, Int16, Int32, Int64, UInt16, UInt32, UInt64, Single, Double, Decimal, DateTime and String. 此外, Convert类还包括支持其他类型的转换的方法。In addition, the Convert class includes methods to support other kinds of conversions.

本主题包括以下各节:This topic consists of the following sections:

与基类型之间的转换 Conversions to and from Base Types
非十进制数字 Non-Decimal Numbers
从自定义对象到基类型的转换 Conversions from Custom Objects to Base Types
区域性特定的格式设置信息 Culture-Specific Formatting Information
Base64 编码 Base64 Encoding
其他常见转换Other Common Conversions

与基类型之间的转换Conversions to and from Base Types

存在将每个基类型转换为每个其他基类型的转换方法。A conversion method exists to convert every base type to every other base type. 但是,对特定转换方法的实际调用会生成五个结果中的一个,具体取决于运行时基类型的值和目标基类型。However, the actual call to a particular conversion method can produce one of five outcomes, depending on the value of the base type at run time and the target base type. 这五个结果为:These five outcomes are:

  • 无转换。No conversion. 当尝试从类型转换为自身(例如,通过使用类型Convert.ToInt32(Int32) Int32的参数调用)时,会发生这种情况。This occurs when an attempt is made to convert from a type to itself (for example, by calling Convert.ToInt32(Int32) with an argument of type Int32). 在这种情况下,方法只返回原始类型的实例。In this case, the method simply returns an instance of the original type.

  • 一个 InvalidCastExceptionAn InvalidCastException. 当不支持特定转换时,会发生这种情况。This occurs when a particular conversion is not supported. InvalidCastException为以下转换引发:An InvalidCastException is thrown for the following conversions:

  • FormatExceptionA FormatException. 当尝试将字符串值转换为其他任何基类型时,如果该字符串的格式不正确,则会发生这种情况。This occurs when the attempt to convert a string value to any other base type fails because the string is not in the proper format. 对于以下转换,将引发异常:The exception is thrown for the following conversions:

    • 要转换为Boolean值的字符串不等于Boolean.TrueStringBoolean.FalseStringA string to be converted to a Boolean value does not equal Boolean.TrueString or Boolean.FalseString.

    • 要转换为Char值的字符串由多个字符组成。A string to be converted to a Char value consists of multiple characters.

    • 要转换为任意数值类型的字符串未被识别为有效数字。A string to be converted to any numeric type is not recognized as a valid number.

    • 要转换为的DateTime字符串未被识别为有效的日期和时间值。A string to be converted to a DateTime is not recognized as a valid date and time value.

  • 成功的转换。A successful conversion. 对于前面的结果中未列出的两个不同的基类型之间的转换,所有扩大转换以及不会导致数据丢失的所有收缩转换都将成功,并且方法将返回目标基类型的值。For conversions between two different base types not listed in the previous outcomes, all widening conversions as well as all narrowing conversions that do not result in a loss of data will succeed and the method will return a value of the targeted base type.

  • 一个 OverflowExceptionAn OverflowException. 当收缩转换导致数据丢失时,会发生这种情况。This occurs when a narrowing conversion results in a loss of data. 例如,如果尝试将值为Int32 10000 的实例转换Byte为类型,则会引发OverflowExceptionByte因为10000超出了数据类型的范围。For example, trying to convert a Int32 instance whose value is 10000 to a Byte type throws an OverflowException because 10000 is outside the range of the Byte data type.

如果转换数值类型会导致精度损失(即,丢失一些最小有效位),则不会引发异常。An exception will not be thrown if the conversion of a numeric type results in a loss of precision (that is, the loss of some least significant digits). 但是,如果结果大于可用特定转换方法的返回值类型表示的结果,则会引发异常。However, an exception will be thrown if the result is larger than can be represented by the particular conversion method's return value type.

例如,当转换Double Single为时,可能会发生精度损失,但不会引发异常。For example, when a Double is converted to a Single, a loss of precision might occur but no exception is thrown. 但是,如果的量Double太大而无法由表示Single,则会引发溢出异常。However, if the magnitude of the Double is too large to be represented by a Single, an overflow exception is thrown.

非十进制数字Non-Decimal Numbers

Convert类包含静态方法,您可以调用这些方法将整数值转换为非十进制字符串表示形式,并将表示非十进制数字的字符串转换为整数值。The Convert class includes static methods that you can call to convert integral values to non-decimal string representations, and to convert strings that represent non-decimal numbers to integral values. 这些转换方法中的每一base种都包含一个参数,该参数可用于指定数字系统、二进制(基数为2)、八进制(基数为8)和十进制(以10为底)。Each of these conversion methods includes a base argument that lets you specify the number system; binary (base 2), octal (base 8), and hexadecimal (base 16), as well as decimal (base 10). 有一组方法可以将符合 CLS 的每个基元整型类型转换为一个字符串,还可以将一个字符串转换为每个基元整型类型:There is a set of methods to convert each of the CLS-compliant primitive integral types to a string, and one to convert a string to each of the primitive integral types:

下面的示例将的Int16.MaxValue值转换为支持的所有数字格式的字符串。The following example converts the value of Int16.MaxValue to a string in all supported numeric formats. 然后,它将字符串值转换回某个Int16值。It then converts the string value back to a Int16 value.

using namespace System;

void main()
{
   array<int>^ baseValues = { 2, 8, 10, 16 };
   Int16 value = Int16::MaxValue;
   for each (Int16 baseValue in baseValues) {
      String^ s = Convert::ToString(value, baseValue);
      Int16 value2 = Convert::ToInt16(s, baseValue);

      Console::WriteLine("{0} --> {1} (base {2}) --> {3}", 
                        value, s, baseValue, value2);
   }                     
}
// The example displays the following output:
//     32767 --> 111111111111111 (base 2) --> 32767
//     32767 --> 77777 (base 8) --> 32767
//     32767 --> 32767 (base 10) --> 32767
//     32767 --> 7fff (base 16) --> 32767
using System;

public class Example
{
   public static void Main()
   {
      int[] baseValues = { 2, 8, 10, 16 };
      short value = Int16.MaxValue;
      foreach (var baseValue in baseValues) {
         String s = Convert.ToString(value, baseValue);
         short value2 = Convert.ToInt16(s, baseValue);

         Console.WriteLine("{0} --> {1} (base {2}) --> {3}", 
                           value, s, baseValue, value2);
      }                     
   }
}
// The example displays the following output:
//     32767 --> 111111111111111 (base 2) --> 32767
//     32767 --> 77777 (base 8) --> 32767
//     32767 --> 32767 (base 10) --> 32767
//     32767 --> 7fff (base 16) --> 32767
Module Example
   Public Sub Main()
      Dim baseValues() As Integer = { 2, 8, 10, 16 }
      Dim value As Short = Int16.MaxValue
      For Each baseValue in baseValues
         Dim s As String = Convert.ToString(value, baseValue)
         Dim value2 As Short = Convert.ToInt16(s, baseValue)

         Console.WriteLine("{0} --> {1} (base {2}) --> {3}", 
                           value, s, baseValue, value2)
      Next
   End Sub
End Module
' The example displays the following output:
'     32767 --> 111111111111111 (base 2) --> 32767
'     32767 --> 77777 (base 8) --> 32767
'     32767 --> 32767 (base 10) --> 32767
'     32767 --> 7fff (base 16) --> 32767

从自定义对象到基类型的转换Conversions from Custom Objects to Base Types

除了支持基类型之间的转换,该Convert方法还支持将任何自定义类型转换为任何基类型。In addition to supporting conversions between the base types, the Convert method supports conversion of any custom type to any base type. 为此,自定义类型必须实现IConvertible接口,该接口定义将实现类型转换为每个基类型的方法。To do this, the custom type must implement the IConvertible interface, which defines methods for converting the implementing type to each of the base types. 特定类型不支持的转换应引发InvalidCastExceptionConversions that are not supported by a particular type should throw an InvalidCastException.

当向ChangeType方法传递自定义类型作为其第一个参数时,或Convert.To类型方法(如Convert.ToInt32(Object)Convert.ToDouble(Object, IFormatProvider)被调用,并将自定义类型的实例作为其第一个参数Convert传递时,方法又调用自定义类型的IConvertible实现来执行转换。When the ChangeType method is passed a custom type as its first parameter, or when the Convert.ToType method (such as Convert.ToInt32(Object) or Convert.ToDouble(Object, IFormatProvider) is called and passed an instance of a custom type as its first parameter, the Convert method, in turn, calls the custom type's IConvertible implementation to perform the conversion. 有关详细信息,请参阅.NET Framework 中的类型转换For more information, see Type Conversion in the .NET Framework.

区域性特定的格式设置信息Culture-Specific Formatting Information

所有基类型转换方法和ChangeType方法都包含具有类型IFormatProvider为的参数的重载。All the base type conversion methods and the ChangeType method include overloads that have a parameter of type IFormatProvider. 例如, Convert.ToBoolean方法具有以下两个重载:For example, the Convert.ToBoolean method has the following two overloads:

IFormatProvider参数可以提供区域性特定的格式设置信息来帮助转换过程。The IFormatProvider parameter can supply culture-specific formatting information to assist the conversion process. 但是,它将被大多数基类型转换方法忽略。However, it is ignored by most of the base type conversion methods. 它仅用于以下基类型转换方法。如果将参数传递给这些方法,则使用表示当前线程区域性的对象。CultureInfo IFormatProvider nullIt is used only by the following base type conversion methods.If a nullIFormatProvider argument is passed to these methods, the CultureInfo object that represents the current thread culture is used.

但是,任何实现IConvertible的用户定义类型都可使用IFormatProvider参数。However, any user-defined type that implements IConvertible can make use of the IFormatProvider parameter.

Base64 编码Base64 Encoding

Base64 编码将二进制数据转换为字符串。Base64 encoding converts binary data to a string. 可以轻松地通过只能传输7位字符的数据通道来传达以64位数字表示的数据。Data expressed as base-64 digits can be easily conveyed over data channels that can only transmit 7-bit characters. Convert类包括以下用于支持 base64 编码的方法:一组方法支持将字节数组转换为或从 a 或 a String数组转换为 Unicode 字符数组和由64位字符组成的 Unicode 字符数组。The Convert class includes the following methods to support base64 encoding: A set of methods support converting an array of bytes to and from a String or to and from an array of Unicode characters consisting of base-64 digit characters.

其他常见转换Other Common Conversions

您可以使用 NET Framework 中的其他类来执行某些不受Convert类的静态方法支持的转换。You can use other classes in the NET Framework to perform some conversions that are not supported by the static methods of the Convert class. 这些方法包括:These include:

转换为字节数组Conversion to byte arrays
类提供一些方法,这些方法可将基元数值类型Boolean(包括)转换为字节数组,并将从字节数组转换回基元数据类型。 BitConverterThe BitConverter class provides methods that convert the primitive numeric types (including Boolean) to byte arrays and from byte arrays back to primitive data types.

字符编码和解码Character encoding and decoding
类及其派生类( UnicodeEncoding如和UTF8Encoding)提供用于对字符数组或字符串进行编码的方法(即,将它们转换为特定编码的字节数组),并对编码的字节数组进行解码(也就是说, Encoding将字节数组转换回 UTF16 编码的 Unicode 字符。The Encoding class and its derived classes (such as UnicodeEncoding and UTF8Encoding) provide methods to encode a character array or a string (that is, to convert them to a byte array in a particular encoding) and to decode an encoded byte array (that is, convert a byte array back to UTF16-encoded Unicode characters. 有关详细信息,请参阅中的字符编码 .NET FrameworkFor more information, see Character Encoding in the .NET Framework

字段

DBNull

一个常数,用于表示没有数据的数据库列;即数据库为空。A constant that represents a database column that is absent of data; that is, database null.

方法

ChangeType(Object, Type)

返回一个指定类型的对象,该对象的值等效于指定的对象。Returns an object of the specified type and whose value is equivalent to the specified object.

ChangeType(Object, Type, IFormatProvider)

返回指定类型的对象,其值等效于指定对象。Returns an object of the specified type whose value is equivalent to the specified object. 参数提供区域性特定的格式设置信息。A parameter supplies culture-specific formatting information.

ChangeType(Object, TypeCode)

返回指定类型的对象,其值等效于指定对象。Returns an object of the specified type whose value is equivalent to the specified object.

ChangeType(Object, TypeCode, IFormatProvider)

返回指定类型的对象,其值等效于指定对象。Returns an object of the specified type whose value is equivalent to the specified object. 参数提供区域性特定的格式设置信息。A parameter supplies culture-specific formatting information.

FromBase64CharArray(Char[], Int32, Int32)

将 Unicode 字符数组(它将二进制数据编码为 Base64 数字)的子集转换为等效的 8 位无符号整数数组。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.

FromBase64String(String)

将指定的字符串(它将二进制数据编码为 Base64 数字)转换为等效的 8 位无符号整数数组。Converts the specified string, which encodes binary data as base-64 digits, to an equivalent 8-bit unsigned integer array.

GetTypeCode(Object)

返回指定对象的 TypeCodeReturns the TypeCode for the specified object.

IsDBNull(Object)

返回有关指定对象是否为 DBNull 类型的指示。Returns an indication whether the specified object is of type DBNull.

ToBase64CharArray(Byte[], Int32, Int32, Char[], Int32)

将 8 位无符号整数数组的子集转换为用 Base64 数字编码的 Unicode 字符数组的等价子集。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.

ToBase64CharArray(Byte[], Int32, Int32, Char[], Int32, Base64FormattingOptions)

将 8 位无符号整数数组的子集转换为用 Base64 数字编码的 Unicode 字符数组的等价子集。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.

ToBase64String(Byte[])

将 8 位无符号整数的数组转换为其用 Base64 数字编码的等效字符串表示形式。Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits.

ToBase64String(Byte[], Base64FormattingOptions)

将 8 位无符号整数的数组转换为其用 Base64 数字编码的等效字符串表示形式。Converts an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. 参数指定是否在返回值中插入分行符。A parameter specifies whether to insert line breaks in the return value.

ToBase64String(Byte[], Int32, Int32)

将 8 位无符号整数数组的子集转换为其用 Base64 数字编码的等效字符串表示形式。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.

ToBase64String(Byte[], Int32, Int32, Base64FormattingOptions)

将 8 位无符号整数数组的子集转换为其用 Base64 数字编码的等效字符串表示形式。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.

ToBase64String(ReadOnlySpan<Byte>, Base64FormattingOptions)
ToBoolean(Boolean)

返回指定的布尔值;不执行任何实际的转换。Returns the specified Boolean value; no actual conversion is performed.

ToBoolean(Byte)

将指定的 8 位无符号整数的值转换为等效的布尔值。Converts the value of the specified 8-bit unsigned integer to an equivalent Boolean value.

ToBoolean(Char)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToBoolean(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToBoolean(Decimal)

将指定的十进制数字的值转换为等效的布尔值。Converts the value of the specified decimal number to an equivalent Boolean value.

ToBoolean(Double)

将指定的双精度浮点数的值转换为等效的布尔值。Converts the value of the specified double-precision floating-point number to an equivalent Boolean value.

ToBoolean(Int16)

将指定的 16 位有符号整数的值转换为等效的布尔值。Converts the value of the specified 16-bit signed integer to an equivalent Boolean value.

ToBoolean(Int32)

将指定的 32 位有符号整数的值转换为等效的布尔值。Converts the value of the specified 32-bit signed integer to an equivalent Boolean value.

ToBoolean(Int64)

将指定的 64 位有符号整数的值转换为等效的布尔值。Converts the value of the specified 64-bit signed integer to an equivalent Boolean value.

ToBoolean(Object)

将指定对象的值转换为等效的布尔值。Converts the value of a specified object to an equivalent Boolean value.

ToBoolean(Object, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定对象的值转换为等效的布尔值。Converts the value of the specified object to an equivalent Boolean value, using the specified culture-specific formatting information.

ToBoolean(SByte)

将指定的 8 位有符号整数的值转换为等效的布尔值。Converts the value of the specified 8-bit signed integer to an equivalent Boolean value.

ToBoolean(Single)

将指定的单精度浮点数的值转换为等效的布尔值。Converts the value of the specified single-precision floating-point number to an equivalent Boolean value.

ToBoolean(String)

将逻辑值的指定字符串表示形式转换为其等效的布尔值。Converts the specified string representation of a logical value to its Boolean equivalent.

ToBoolean(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将逻辑值的指定字符串表示形式转换为其等效的布尔值。Converts the specified string representation of a logical value to its Boolean equivalent, using the specified culture-specific formatting information.

ToBoolean(UInt16)

将指定的 16 位无符号整数的值转换为等效的布尔值。Converts the value of the specified 16-bit unsigned integer to an equivalent Boolean value.

ToBoolean(UInt32)

将指定的 32 位无符号整数的值转换为等效的布尔值。Converts the value of the specified 32-bit unsigned integer to an equivalent Boolean value.

ToBoolean(UInt64)

将指定的 64 位无符号整数的值转换为等效的布尔值。Converts the value of the specified 64-bit unsigned integer to an equivalent Boolean value.

ToByte(Boolean)

将指定的布尔值转换为等效的 8 位无符号整数。Converts the specified Boolean value to the equivalent 8-bit unsigned integer.

ToByte(Byte)

返回指定的 8 位无符号整数;不执行任何实际的转换。Returns the specified 8-bit unsigned integer; no actual conversion is performed.

ToByte(Char)

将指定 Unicode 字符的值转换为等效的 8 位无符号整数。Converts the value of the specified Unicode character to the equivalent 8-bit unsigned integer.

ToByte(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToByte(Decimal)

将指定的十进制数的值转换为等效的 8 位无符号整数。Converts the value of the specified decimal number to an equivalent 8-bit unsigned integer.

ToByte(Double)

将指定的双精度浮点数的值转换为等效的 8 位无符号整数。Converts the value of the specified double-precision floating-point number to an equivalent 8-bit unsigned integer.

ToByte(Int16)

将指定的 16 位有符号整数的值转换为等效的 8 位无符号整数。Converts the value of the specified 16-bit signed integer to an equivalent 8-bit unsigned integer.

ToByte(Int32)

将指定的 32 位有符号整数的值转换为等效的 8 位无符号整数。Converts the value of the specified 32-bit signed integer to an equivalent 8-bit unsigned integer.

ToByte(Int64)

将指定的 64 位有符号整数的值转换为等效的 8 位无符号整数。Converts the value of the specified 64-bit signed integer to an equivalent 8-bit unsigned integer.

ToByte(Object)

将指定对象的值转换为 8 位无符号整数。Converts the value of the specified object to an 8-bit unsigned integer.

ToByte(Object, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定对象的值转换为 8 位无符号整数。Converts the value of the specified object to an 8-bit unsigned integer, using the specified culture-specific formatting information.

ToByte(SByte)

将指定的 8 位有符号整数的值转换为等效的 8 位无符号整数。Converts the value of the specified 8-bit signed integer to an equivalent 8-bit unsigned integer.

ToByte(Single)

将指定的单精度浮点数的值转换为等效的 8 位无符号整数。Converts the value of the specified single-precision floating-point number to an equivalent 8-bit unsigned integer.

ToByte(String)

将数字的指定字符串表示形式转换为等效的 8 位无符号整数。Converts the specified string representation of a number to an equivalent 8-bit unsigned integer.

ToByte(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的 8 位无符号整数。Converts the specified string representation of a number to an equivalent 8-bit unsigned integer, using specified culture-specific formatting information.

ToByte(String, Int32)

将指定基数的数字的字符串表示形式转换为等效的 8 位无符号整数。Converts the string representation of a number in a specified base to an equivalent 8-bit unsigned integer.

ToByte(UInt16)

将指定的 16 位无符号整数的值转换为等效的 8 位无符号整数。Converts the value of the specified 16-bit unsigned integer to an equivalent 8-bit unsigned integer.

ToByte(UInt32)

将指定的 32 位无符号整数的值转换为等效的 8 位无符号整数。Converts the value of the specified 32-bit unsigned integer to an equivalent 8-bit unsigned integer.

ToByte(UInt64)

将指定的 64 位无符号整数的值转换为等效的 8 位无符号整数。Converts the value of the specified 64-bit unsigned integer to an equivalent 8-bit unsigned integer.

ToChar(Boolean)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToChar(Byte)

将指定的 8 位无符号整数的值转换为其等效的 Unicode 字符。Converts the value of the specified 8-bit unsigned integer to its equivalent Unicode character.

ToChar(Char)

返回指定的 Unicode 字符值;不执行任何实际的转换。Returns the specified Unicode character value; no actual conversion is performed.

ToChar(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToChar(Decimal)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToChar(Double)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToChar(Int16)

将指定的 16 位有符号整数的值转换为它的等效 Unicode 字符。Converts the value of the specified 16-bit signed integer to its equivalent Unicode character.

ToChar(Int32)

将指定的 32 位有符号整数的值转换为它的等效 Unicode 字符。Converts the value of the specified 32-bit signed integer to its equivalent Unicode character.

ToChar(Int64)

将指定的 64 位有符号整数的值转换为它的等效 Unicode 字符。Converts the value of the specified 64-bit signed integer to its equivalent Unicode character.

ToChar(Object)

将指定对象的值转换为 Unicode 字符。Converts the value of the specified object to a Unicode character.

ToChar(Object, IFormatProvider)

使用指定的区域性特定格式设置信息将指定对象的值转换为其等效的 Unicode 字符。Converts the value of the specified object to its equivalent Unicode character, using the specified culture-specific formatting information.

ToChar(SByte)

将指定的 8 位有符号整数的值转换为它的等效 Unicode 字符。Converts the value of the specified 8-bit signed integer to its equivalent Unicode character.

ToChar(Single)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToChar(String)

将指定字符串的第一个字符转换为 Unicode 字符。Converts the first character of a specified string to a Unicode character.

ToChar(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定字符串的第一个字符转换为 Unicode 字符。Converts the first character of a specified string to a Unicode character, using specified culture-specific formatting information.

ToChar(UInt16)

将指定的 16 位无符号整数的值转换为其等效的 Unicode 字符。Converts the value of the specified 16-bit unsigned integer to its equivalent Unicode character.

ToChar(UInt32)

将指定的 32 位无符号整数的值转换为其等效的 Unicode 字符。Converts the value of the specified 32-bit unsigned integer to its equivalent Unicode character.

ToChar(UInt64)

将指定的 64 位无符号整数的值转换为其等效的 Unicode 字符。Converts the value of the specified 64-bit unsigned integer to its equivalent Unicode character.

ToDateTime(Boolean)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(Byte)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(Char)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(DateTime)

返回指定的 DateTime 对象;不执行任何实际的转换。Returns the specified DateTime object; no actual conversion is performed.

ToDateTime(Decimal)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(Double)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(Int16)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(Int32)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(Int64)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(Object)

将指定对象的值转换为 DateTime 对象。Converts the value of the specified object to a DateTime object.

ToDateTime(Object, IFormatProvider)

使用指定的区域性特定格式设置信息将指定对象的值转换为 DateTime 对象。Converts the value of the specified object to a DateTime object, using the specified culture-specific formatting information.

ToDateTime(SByte)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(Single)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(String)

将日期和时间的指定字符串表示形式转换为等效的日期和时间值。Converts the specified string representation of a date and time to an equivalent date and time value.

ToDateTime(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的日期和时间。Converts the specified string representation of a number to an equivalent date and time, using the specified culture-specific formatting information.

ToDateTime(UInt16)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(UInt32)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDateTime(UInt64)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDecimal(Boolean)

将指定的布尔值转换为等效的十进制数。Converts the specified Boolean value to the equivalent decimal number.

ToDecimal(Byte)

将指定的 8 位无符号整数的值转换为等效的十进制数。Converts the value of the specified 8-bit unsigned integer to the equivalent decimal number.

ToDecimal(Char)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDecimal(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDecimal(Decimal)

返回指定的十进制数;不执行任何实际的转换。Returns the specified decimal number; no actual conversion is performed.

ToDecimal(Double)

将指定的双精度浮点数的值转换为等效的十进制数。Converts the value of the specified double-precision floating-point number to an equivalent decimal number.

ToDecimal(Int16)

将指定的 16 位带符号整数的值转换为等效的十进制数。Converts the value of the specified 16-bit signed integer to an equivalent decimal number.

ToDecimal(Int32)

将指定的 32 位带符号整数的值转换为等效的十进制数。Converts the value of the specified 32-bit signed integer to an equivalent decimal number.

ToDecimal(Int64)

将指定的 64 位带符号整数的值转换为等效的十进制数。Converts the value of the specified 64-bit signed integer to an equivalent decimal number.

ToDecimal(Object)

将指定对象的值转换为等效的十进制数。Converts the value of the specified object to an equivalent decimal number.

ToDecimal(Object, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定对象的值转换为等效的十进制数。Converts the value of the specified object to an equivalent decimal number, using the specified culture-specific formatting information.

ToDecimal(SByte)

将指定的 8 位带符号整数的值转换为等效的十进制数。Converts the value of the specified 8-bit signed integer to the equivalent decimal number.

ToDecimal(Single)

将指定的单精度浮点数的值转换为等效的十进制数。Converts the value of the specified single-precision floating-point number to the equivalent decimal number.

ToDecimal(String)

将数字的指定字符串表示形式转换为等效的十进制数。Converts the specified string representation of a number to an equivalent decimal number.

ToDecimal(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的十进制数。Converts the specified string representation of a number to an equivalent decimal number, using the specified culture-specific formatting information.

ToDecimal(UInt16)

将指定的 16 位无符号整数的值转换为等效的十进制数。Converts the value of the specified 16-bit unsigned integer to an equivalent decimal number.

ToDecimal(UInt32)

将指定的 32 位无符号整数的值转换为等效的十进制数。Converts the value of the specified 32-bit unsigned integer to an equivalent decimal number.

ToDecimal(UInt64)

将指定的 64 位无符号整数的值转换为等效的十进制数。Converts the value of the specified 64-bit unsigned integer to an equivalent decimal number.

ToDouble(Boolean)

将指定的布尔值转换为等效的双精度浮点数。Converts the specified Boolean value to the equivalent double-precision floating-point number.

ToDouble(Byte)

将指定的 8 位无符号整数的值转换为等效的双精度浮点数。Converts the value of the specified 8-bit unsigned integer to the equivalent double-precision floating-point number.

ToDouble(Char)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDouble(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToDouble(Decimal)

将指定的十进制数的值转换为等效的双精度浮点数。Converts the value of the specified decimal number to an equivalent double-precision floating-point number.

ToDouble(Double)

返回指定的双精度浮点数;不执行任何实际的转换。Returns the specified double-precision floating-point number; no actual conversion is performed.

ToDouble(Int16)

将指定的 16 位带符号整数的值转换为等效的双精度浮点数。Converts the value of the specified 16-bit signed integer to an equivalent double-precision floating-point number.

ToDouble(Int32)

将指定的 32 位带符号整数的值转换为等效的双精度浮点数。Converts the value of the specified 32-bit signed integer to an equivalent double-precision floating-point number.

ToDouble(Int64)

将指定的 64 位带符号整数的值转换为等效的双精度浮点数。Converts the value of the specified 64-bit signed integer to an equivalent double-precision floating-point number.

ToDouble(Object)

将指定对象的值转换为双精度浮点数。Converts the value of the specified object to a double-precision floating-point number.

ToDouble(Object, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定对象的值转换为双精度浮点数。Converts the value of the specified object to an double-precision floating-point number, using the specified culture-specific formatting information.

ToDouble(SByte)

将指定的 8 位带符号整数的值转换为等效的双精度浮点数。Converts the value of the specified 8-bit signed integer to the equivalent double-precision floating-point number.

ToDouble(Single)

将指定的单精度浮点数的值转换为等效的双精度浮点数。Converts the value of the specified single-precision floating-point number to an equivalent double-precision floating-point number.

ToDouble(String)

将数字的指定字符串表示形式转换为等效的双精度浮点数。Converts the specified string representation of a number to an equivalent double-precision floating-point number.

ToDouble(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的双精度浮点数。Converts the specified string representation of a number to an equivalent double-precision floating-point number, using the specified culture-specific formatting information.

ToDouble(UInt16)

将指定的 16 位无符号整数的值转换为等效的双精度浮点数。Converts the value of the specified 16-bit unsigned integer to the equivalent double-precision floating-point number.

ToDouble(UInt32)

将指定的 32 位无符号整数的值转换为等效的双精度浮点数。Converts the value of the specified 32-bit unsigned integer to an equivalent double-precision floating-point number.

ToDouble(UInt64)

将指定的 64 位无符号整数的值转换为等效的双精度浮点数。Converts the value of the specified 64-bit unsigned integer to an equivalent double-precision floating-point number.

ToInt16(Boolean)

将指定的布尔值转换为等效的 16 位带符号整数。Converts the specified Boolean value to the equivalent 16-bit signed integer.

ToInt16(Byte)

将指定的 8 位无符号整数的值转换为等效的 16 位有符号整数。Converts the value of the specified 8-bit unsigned integer to the equivalent 16-bit signed integer.

ToInt16(Char)

将指定的 Unicode 字符的值转换为等效的 16 位有符号整数。Converts the value of the specified Unicode character to the equivalent 16-bit signed integer.

ToInt16(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToInt16(Decimal)

将指定的十进制数的值转换为等效的 16 位带符号整数。Converts the value of the specified decimal number to an equivalent 16-bit signed integer.

ToInt16(Double)

将指定的双精度浮点数的值转换为等效的 16 位带符号整数。Converts the value of the specified double-precision floating-point number to an equivalent 16-bit signed integer.

ToInt16(Int16)

返回指定的 16 位有符号整数;不执行实际的转换。Returns the specified 16-bit signed integer; no actual conversion is performed.

ToInt16(Int32)

将指定的 32 位有符号整数的值转换为等效的 16 位有符号整数。Converts the value of the specified 32-bit signed integer to an equivalent 16-bit signed integer.

ToInt16(Int64)

将指定的 64 位有符号整数的值转换为等效的 16 位有符号整数。Converts the value of the specified 64-bit signed integer to an equivalent 16-bit signed integer.

ToInt16(Object)

将指定对象的值转换为 16 位带符号整数。Converts the value of the specified object to a 16-bit signed integer.

ToInt16(Object, IFormatProvider)

使用指定的区域性特定格式信息,将指定对象的值转换为 16 位带符号整数。Converts the value of the specified object to a 16-bit signed integer, using the specified culture-specific formatting information.

ToInt16(SByte)

将指定的 8 位带符号整数的值转换为等效的 16 位带符号整数。Converts the value of the specified 8-bit signed integer to the equivalent 16-bit signed integer.

ToInt16(Single)

将指定的单精度浮点数的值转换为等效的 16 位带符号整数。Converts the value of the specified single-precision floating-point number to an equivalent 16-bit signed integer.

ToInt16(String)

将数字的指定字符串表示形式转换为等效的 16 位带符号整数。Converts the specified string representation of a number to an equivalent 16-bit signed integer.

ToInt16(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的 16 位带符号整数。Converts the specified string representation of a number to an equivalent 16-bit signed integer, using the specified culture-specific formatting information.

ToInt16(String, Int32)

将指定基数的数字的字符串表示形式转换为等效的 16 位有符号整数。Converts the string representation of a number in a specified base to an equivalent 16-bit signed integer.

ToInt16(UInt16)

将指定的 16 位无符号整数的值转换为等效的 16 位有符号整数。Converts the value of the specified 16-bit unsigned integer to the equivalent 16-bit signed integer.

ToInt16(UInt32)

将指定的 32 位无符号整数的值转换为等效的 16 位有符号整数。Converts the value of the specified 32-bit unsigned integer to an equivalent 16-bit signed integer.

ToInt16(UInt64)

将指定的 64 位无符号整数的值转换为等效的 16 位有符号整数。Converts the value of the specified 64-bit unsigned integer to an equivalent 16-bit signed integer.

ToInt32(Boolean)

将指定的布尔值转换为等效的 32 位带符号整数。Converts the specified Boolean value to the equivalent 32-bit signed integer.

ToInt32(Byte)

将指定的 8 位无符号整数的值转换为等效的 32 位有符号整数。Converts the value of the specified 8-bit unsigned integer to the equivalent 32-bit signed integer.

ToInt32(Char)

将指定的 Unicode 字符的值转换为等效的 32 位有符号整数。Converts the value of the specified Unicode character to the equivalent 32-bit signed integer.

ToInt32(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToInt32(Decimal)

将指定的十进制数的值转换为等效的 32 位带符号整数。Converts the value of the specified decimal number to an equivalent 32-bit signed integer.

ToInt32(Double)

将指定的双精度浮点数的值转换为等效的 32 位带符号整数。Converts the value of the specified double-precision floating-point number to an equivalent 32-bit signed integer.

ToInt32(Int16)

将指定的 16 位有符号整数的值转换为等效的 32 位有符号整数。Converts the value of the specified 16-bit signed integer to an equivalent 32-bit signed integer.

ToInt32(Int32)

返回指定的 32 位有符号整数;不执行实际的转换。Returns the specified 32-bit signed integer; no actual conversion is performed.

ToInt32(Int64)

将指定的 64 位有符号整数的值转换为等效的 32 位有符号整数。Converts the value of the specified 64-bit signed integer to an equivalent 32-bit signed integer.

ToInt32(Object)

将指定对象的值转换为 32 位带符号整数。Converts the value of the specified object to a 32-bit signed integer.

ToInt32(Object, IFormatProvider)

使用指定的区域性特定格式信息,将指定对象的值转换为 32 位带符号整数。Converts the value of the specified object to a 32-bit signed integer, using the specified culture-specific formatting information.

ToInt32(SByte)

将指定的 8 位带符号整数的值转换为等效的 32 位带符号整数。Converts the value of the specified 8-bit signed integer to the equivalent 32-bit signed integer.

ToInt32(Single)

将指定的单精度浮点数的值转换为等效的 32 位带符号整数。Converts the value of the specified single-precision floating-point number to an equivalent 32-bit signed integer.

ToInt32(String)

将数字的指定字符串表示形式转换为等效的 32 位带符号整数。Converts the specified string representation of a number to an equivalent 32-bit signed integer.

ToInt32(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的 32 位带符号整数。Converts the specified string representation of a number to an equivalent 32-bit signed integer, using the specified culture-specific formatting information.

ToInt32(String, Int32)

将指定基数的数字的字符串表示形式转换为等效的 32 位有符号整数。Converts the string representation of a number in a specified base to an equivalent 32-bit signed integer.

ToInt32(UInt16)

将指定的 16 位无符号整数的值转换为等效的 32 位有符号整数。Converts the value of the specified 16-bit unsigned integer to the equivalent 32-bit signed integer.

ToInt32(UInt32)

将指定的 32 位无符号整数的值转换为等效的 32 位有符号整数。Converts the value of the specified 32-bit unsigned integer to an equivalent 32-bit signed integer.

ToInt32(UInt64)

将指定的 64 位无符号整数的值转换为等效的 32 位有符号整数。Converts the value of the specified 64-bit unsigned integer to an equivalent 32-bit signed integer.

ToInt64(Boolean)

将指定的布尔值转换为等效的 64 位带符号整数。Converts the specified Boolean value to the equivalent 64-bit signed integer.

ToInt64(Byte)

将指定的 8 位无符号整数的值转换为等效的 64 位有符号整数。Converts the value of the specified 8-bit unsigned integer to the equivalent 64-bit signed integer.

ToInt64(Char)

将指定的 Unicode 字符的值转换为等效的 64 位有符号整数。Converts the value of the specified Unicode character to the equivalent 64-bit signed integer.

ToInt64(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToInt64(Decimal)

将指定的十进制数的值转换为等效的 64 位带符号整数。Converts the value of the specified decimal number to an equivalent 64-bit signed integer.

ToInt64(Double)

将指定的双精度浮点数的值转换为等效的 64 位带符号整数。Converts the value of the specified double-precision floating-point number to an equivalent 64-bit signed integer.

ToInt64(Int16)

将指定的 16 位有符号整数的值转换为等效的 64 位有符号整数。Converts the value of the specified 16-bit signed integer to an equivalent 64-bit signed integer.

ToInt64(Int32)

将指定的 32 位有符号整数的值转换为等效的 64 位有符号整数。Converts the value of the specified 32-bit signed integer to an equivalent 64-bit signed integer.

ToInt64(Int64)

返回指定的 64 位有符号整数;不执行实际的转换。Returns the specified 64-bit signed integer; no actual conversion is performed.

ToInt64(Object)

将指定对象的值转换为 64 位带符号整数。Converts the value of the specified object to a 64-bit signed integer.

ToInt64(Object, IFormatProvider)

使用指定的区域性特定格式信息,将指定对象的值转换为 64 位带符号整数。Converts the value of the specified object to a 64-bit signed integer, using the specified culture-specific formatting information.

ToInt64(SByte)

将指定的 8 位带符号整数的值转换为等效的 64 位带符号整数。Converts the value of the specified 8-bit signed integer to the equivalent 64-bit signed integer.

ToInt64(Single)

将指定的单精度浮点数的值转换为等效的 64 位带符号整数。Converts the value of the specified single-precision floating-point number to an equivalent 64-bit signed integer.

ToInt64(String)

将数字的指定字符串表示形式转换为等效的 64 位带符号整数。Converts the specified string representation of a number to an equivalent 64-bit signed integer.

ToInt64(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的 64 位带符号整数。Converts the specified string representation of a number to an equivalent 64-bit signed integer, using the specified culture-specific formatting information.

ToInt64(String, Int32)

将指定基数的数字的字符串表示形式转换为等效的 64 位有符号整数。Converts the string representation of a number in a specified base to an equivalent 64-bit signed integer.

ToInt64(UInt16)

将指定的 16 位无符号整数的值转换为等效的 64 位有符号整数。Converts the value of the specified 16-bit unsigned integer to the equivalent 64-bit signed integer.

ToInt64(UInt32)

将指定的 32 位无符号整数的值转换为等效的 64 位有符号整数。Converts the value of the specified 32-bit unsigned integer to an equivalent 64-bit signed integer.

ToInt64(UInt64)

将指定的 64 位无符号整数的值转换为等效的 64 位有符号整数。Converts the value of the specified 64-bit unsigned integer to an equivalent 64-bit signed integer.

ToSByte(Boolean)

将指定的布尔值转换为等效的 8 位带符号整数。Converts the specified Boolean value to the equivalent 8-bit signed integer.

ToSByte(Byte)

将指定的 8 位无符号整数的值转换为等效的 8 位有符号整数。Converts the value of the specified 8-bit unsigned integer to the equivalent 8-bit signed integer.

ToSByte(Char)

将指定的 Unicode 字符的值转换为等效的 8 位有符号整数。Converts the value of the specified Unicode character to the equivalent 8-bit signed integer.

ToSByte(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToSByte(Decimal)

将指定的十进制数的值转换为等效的 8 位带符号整数。Converts the value of the specified decimal number to an equivalent 8-bit signed integer.

ToSByte(Double)

将指定的双精度浮点数的值转换为等效的 8 位带符号整数。Converts the value of the specified double-precision floating-point number to an equivalent 8-bit signed integer.

ToSByte(Int16)

将指定的 16 位带符号整数的值转换为等效的 8 位带符号整数。Converts the value of the specified 16-bit signed integer to the equivalent 8-bit signed integer.

ToSByte(Int32)

将指定的 32 位有符号整数的值转换为等效的 8 位有符号整数。Converts the value of the specified 32-bit signed integer to an equivalent 8-bit signed integer.

ToSByte(Int64)

将指定的 64 位有符号整数的值转换为等效的 8 位有符号整数。Converts the value of the specified 64-bit signed integer to an equivalent 8-bit signed integer.

ToSByte(Object)

将指定对象的值转换为 8 位带符号整数。Converts the value of the specified object to an 8-bit signed integer.

ToSByte(Object, IFormatProvider)

使用指定的区域性特定格式信息,将指定对象的值转换为 8 位带符号整数。Converts the value of the specified object to an 8-bit signed integer, using the specified culture-specific formatting information.

ToSByte(SByte)

返回指定的 8 位有符号整数;不执行实际的转换。Returns the specified 8-bit signed integer; no actual conversion is performed.

ToSByte(Single)

将指定的单精度浮点数的值转换为等效的 8 位带符号整数。Converts the value of the specified single-precision floating-point number to an equivalent 8-bit signed integer.

ToSByte(String)

将数字的指定字符串表示形式转换为等效的 8 位带符号整数。Converts the specified string representation of a number to an equivalent 8-bit signed integer.

ToSByte(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的 8 位带符号整数。Converts the specified string representation of a number to an equivalent 8-bit signed integer, using the specified culture-specific formatting information.

ToSByte(String, Int32)

将指定基数的数字的字符串表示形式转换为等效的 8 位有符号整数。Converts the string representation of a number in a specified base to an equivalent 8-bit signed integer.

ToSByte(UInt16)

将指定的 16 位无符号整数的值转换为等效的 8 位有符号整数。Converts the value of the specified 16-bit unsigned integer to the equivalent 8-bit signed integer.

ToSByte(UInt32)

将指定的 32 位无符号整数的值转换为等效的 8 位有符号整数。Converts the value of the specified 32-bit unsigned integer to an equivalent 8-bit signed integer.

ToSByte(UInt64)

将指定的 64 位无符号整数的值转换为等效的 8 位有符号整数。Converts the value of the specified 64-bit unsigned integer to an equivalent 8-bit signed integer.

ToSingle(Boolean)

将指定的布尔值转换为等效的单精度浮点数。Converts the specified Boolean value to the equivalent single-precision floating-point number.

ToSingle(Byte)

将指定的 8 位无符号整数的值转换为等效的单精度浮点数。Converts the value of the specified 8-bit unsigned integer to the equivalent single-precision floating-point number.

ToSingle(Char)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToSingle(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToSingle(Decimal)

将指定的十进制数的值转换为等效的单精度浮点数。Converts the value of the specified decimal number to an equivalent single-precision floating-point number.

ToSingle(Double)

将指定的双精度浮点数的值转换为等效的单精度浮点数。Converts the value of the specified double-precision floating-point number to an equivalent single-precision floating-point number.

ToSingle(Int16)

将指定的 16 位带符号整数的值转换为等效的单精度浮点数。Converts the value of the specified 16-bit signed integer to an equivalent single-precision floating-point number.

ToSingle(Int32)

将指定的 32 位带符号整数的值转换为等效的单精度浮点数。Converts the value of the specified 32-bit signed integer to an equivalent single-precision floating-point number.

ToSingle(Int64)

将指定的 64 位带符号整数的值转换为等效的单精度浮点数。Converts the value of the specified 64-bit signed integer to an equivalent single-precision floating-point number.

ToSingle(Object)

将指定对象的值转换为单精度浮点数。Converts the value of the specified object to a single-precision floating-point number.

ToSingle(Object, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定对象的值转换为单精度浮点数。Converts the value of the specified object to an single-precision floating-point number, using the specified culture-specific formatting information.

ToSingle(SByte)

将指定的 8 位带符号整数的值转换为等效的单精度浮点数。Converts the value of the specified 8-bit signed integer to the equivalent single-precision floating-point number.

ToSingle(Single)

返回指定的单精度浮点数;不执行任何实际的转换。Returns the specified single-precision floating-point number; no actual conversion is performed.

ToSingle(String)

将数字的指定字符串表示形式转换为等效的单精度浮点数。Converts the specified string representation of a number to an equivalent single-precision floating-point number.

ToSingle(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的单精度浮点数。Converts the specified string representation of a number to an equivalent single-precision floating-point number, using the specified culture-specific formatting information.

ToSingle(UInt16)

将指定的 16 位无符号整数的值转换为等效的单精度浮点数。Converts the value of the specified 16-bit unsigned integer to the equivalent single-precision floating-point number.

ToSingle(UInt32)

将指定的 32 位无符号整数的值转换为等效的单精度浮点数。Converts the value of the specified 32-bit unsigned integer to an equivalent single-precision floating-point number.

ToSingle(UInt64)

将指定的 64 位无符号整数的值转换为等效的单精度浮点数。Converts the value of the specified 64-bit unsigned integer to an equivalent single-precision floating-point number.

ToString(Boolean)

将指定的布尔值转换为其等效的字符串表示形式。Converts the specified Boolean value to its equivalent string representation.

ToString(Boolean, IFormatProvider)

将指定的布尔值转换为其等效的字符串表示形式。Converts the specified Boolean value to its equivalent string representation.

ToString(Byte)

将指定的 8 位无符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 8-bit unsigned integer to its equivalent string representation.

ToString(Byte, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的 8 位无符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 8-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information.

ToString(Byte, Int32)

将 8 位无符号整数的值转换为其等效的指定基数的字符串表示形式。Converts the value of an 8-bit unsigned integer to its equivalent string representation in a specified base.

ToString(Char)

将指定的 Unicode 字符的值转换为其等效的字符串表示形式。Converts the value of the specified Unicode character to its equivalent string representation.

ToString(Char, IFormatProvider)

使用指定的区域性特定格式设置信息将指定的 Unicode 字符的值转换为其等效的字符串表示形式。Converts the value of the specified Unicode character to its equivalent string representation, using the specified culture-specific formatting information.

ToString(DateTime)

将指定的 DateTime 的值转换为其等效的字符串表示形式。Converts the value of the specified DateTime to its equivalent string representation.

ToString(DateTime, IFormatProvider)

使用指定的区域性特定格式设置信息将指定的 DateTime 的值转换为其等效的字符串表示形式。Converts the value of the specified DateTime to its equivalent string representation, using the specified culture-specific formatting information.

ToString(Decimal)

将指定的十进制数的值转换为其等效的字符串表示形式。Converts the value of the specified decimal number to its equivalent string representation.

ToString(Decimal, IFormatProvider)

使用指定的区域性特定格式设置信息将指定的十进制数的值转换为其等效的字符串表示形式。Converts the value of the specified decimal number to its equivalent string representation, using the specified culture-specific formatting information.

ToString(Double)

将指定的双精度浮点数的值转换其等效的字符串表示形式。Converts the value of the specified double-precision floating-point number to its equivalent string representation.

ToString(Double, IFormatProvider)

将指定的双精度浮点数的值转换其等效的字符串表示形式。Converts the value of the specified double-precision floating-point number to its equivalent string representation.

ToString(Int16)

将指定的 16 位带符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 16-bit signed integer to its equivalent string representation.

ToString(Int16, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的 16 位带符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 16-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information.

ToString(Int16, Int32)

将 16 位带符号整数的值转换为其指定基的等效字符串表示形式。Converts the value of a 16-bit signed integer to its equivalent string representation in a specified base.

ToString(Int32)

将指定的 32 位带符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 32-bit signed integer to its equivalent string representation.

ToString(Int32, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的 32 位带符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 32-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information.

ToString(Int32, Int32)

将 32 位带符号整数的值转换为其指定基的等效字符串表示形式。Converts the value of a 32-bit signed integer to its equivalent string representation in a specified base.

ToString(Int64)

将指定的 64 位带符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 64-bit signed integer to its equivalent string representation.

ToString(Int64, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的 64 位带符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 64-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information.

ToString(Int64, Int32)

将 64 位带符号整数的值转换为其指定基的等效字符串表示形式。Converts the value of a 64-bit signed integer to its equivalent string representation in a specified base.

ToString(Object)

将指定对象的值转换为其等效的字符串表示形式。Converts the value of the specified object to its equivalent string representation.

ToString(Object, IFormatProvider)

使用指定的区域性特定格式设置信息将指定对象的值转换为其等效的字符串表示形式。Converts the value of the specified object to its equivalent string representation using the specified culture-specific formatting information.

ToString(SByte)

将指定的 8 位带符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 8-bit signed integer to its equivalent string representation.

ToString(SByte, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的 8 位带符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 8-bit signed integer to its equivalent string representation, using the specified culture-specific formatting information.

ToString(Single)

将指定的单精度浮点数的值转换其等效的字符串表示形式。Converts the value of the specified single-precision floating-point number to its equivalent string representation.

ToString(Single, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的单精度浮点数的值转换为其等效的字符串表示形式。Converts the value of the specified single-precision floating-point number to its equivalent string representation, using the specified culture-specific formatting information.

ToString(String)

返回指定的字符串实例;不执行任何实际转换。Returns the specified string instance; no actual conversion is performed.

ToString(String, IFormatProvider)

返回指定的字符串实例;不执行任何实际转换。Returns the specified string instance; no actual conversion is performed.

ToString(UInt16)

将指定的 16 位无符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 16-bit unsigned integer to its equivalent string representation.

ToString(UInt16, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的 16 位无符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 16-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information.

ToString(UInt32)

将指定的 32 位无符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 32-bit unsigned integer to its equivalent string representation.

ToString(UInt32, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的 32 位无符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 32-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information.

ToString(UInt64)

将指定的 64 位无符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 64-bit unsigned integer to its equivalent string representation.

ToString(UInt64, IFormatProvider)

使用指定的区域性特定格式设置信息,将指定的 64 位无符号整数的值转换为其等效的字符串表示形式。Converts the value of the specified 64-bit unsigned integer to its equivalent string representation, using the specified culture-specific formatting information.

ToUInt16(Boolean)

将指定的布尔值转换为等效的 16 位无符号整数。Converts the specified Boolean value to the equivalent 16-bit unsigned integer.

ToUInt16(Byte)

将指定的 8 位无符号整数的值转换为等效的 16 位无符号整数。Converts the value of the specified 8-bit unsigned integer to the equivalent 16-bit unsigned integer.

ToUInt16(Char)

将指定 Unicode 字符的值转换为等效的 16 位无符号整数。Converts the value of the specified Unicode character to the equivalent 16-bit unsigned integer.

ToUInt16(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToUInt16(Decimal)

将指定的十进制数的值转换为等效的 16 位无符号整数。Converts the value of the specified decimal number to an equivalent 16-bit unsigned integer.

ToUInt16(Double)

将指定的双精度浮点数的值转换为等效的 16 位无符号整数。Converts the value of the specified double-precision floating-point number to an equivalent 16-bit unsigned integer.

ToUInt16(Int16)

将指定的 16 位有符号整数的值转换为等效的 16 位无符号整数。Converts the value of the specified 16-bit signed integer to the equivalent 16-bit unsigned integer.

ToUInt16(Int32)

将指定的 32 位有符号整数的值转换为等效的 16 位无符号整数。Converts the value of the specified 32-bit signed integer to an equivalent 16-bit unsigned integer.

ToUInt16(Int64)

将指定的 64 位有符号整数的值转换为等效的 16 位无符号整数。Converts the value of the specified 64-bit signed integer to an equivalent 16-bit unsigned integer.

ToUInt16(Object)

将指定对象的值转换为 16 位无符号整数。Converts the value of the specified object to a 16-bit unsigned integer.

ToUInt16(Object, IFormatProvider)

使用指定的区域性特定格式信息,将指定对象的值转换为 16 位无符号整数。Converts the value of the specified object to a 16-bit unsigned integer, using the specified culture-specific formatting information.

ToUInt16(SByte)

将指定的 8 位有符号整数的值转换为等效的 16 位无符号整数。Converts the value of the specified 8-bit signed integer to the equivalent 16-bit unsigned integer.

ToUInt16(Single)

将指定的单精度浮点数的值转换为等效的 16 位无符号整数。Converts the value of the specified single-precision floating-point number to an equivalent 16-bit unsigned integer.

ToUInt16(String)

将数字的指定字符串表示形式转换为等效的 16 位无符号整数。Converts the specified string representation of a number to an equivalent 16-bit unsigned integer.

ToUInt16(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的 16 位无符号整数。Converts the specified string representation of a number to an equivalent 16-bit unsigned integer, using the specified culture-specific formatting information.

ToUInt16(String, Int32)

将指定基数的数字的字符串表示形式转换为等效的 16 位无符号整数。Converts the string representation of a number in a specified base to an equivalent 16-bit unsigned integer.

ToUInt16(UInt16)

返回指定的 16 位无符号整数;不执行任何实际的转换。Returns the specified 16-bit unsigned integer; no actual conversion is performed.

ToUInt16(UInt32)

将指定的 32 位无符号整数的值转换为等效的 16 位无符号整数。Converts the value of the specified 32-bit unsigned integer to an equivalent 16-bit unsigned integer.

ToUInt16(UInt64)

将指定的 64 位无符号整数的值转换为等效的 16 位无符号整数。Converts the value of the specified 64-bit unsigned integer to an equivalent 16-bit unsigned integer.

ToUInt32(Boolean)

将指定的布尔值转换为等效的 32 位无符号整数。Converts the specified Boolean value to the equivalent 32-bit unsigned integer.

ToUInt32(Byte)

将指定的 8 位无符号整数的值转换为等效的 32 位无符号整数。Converts the value of the specified 8-bit unsigned integer to the equivalent 32-bit unsigned integer.

ToUInt32(Char)

将指定 Unicode 字符的值转换为等效的 32 位无符号整数。Converts the value of the specified Unicode character to the equivalent 32-bit unsigned integer.

ToUInt32(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToUInt32(Decimal)

将指定的十进制数的值转换为等效的 32 位无符号整数。Converts the value of the specified decimal number to an equivalent 32-bit unsigned integer.

ToUInt32(Double)

将指定的双精度浮点数的值转换为等效的 32 位无符号整数。Converts the value of the specified double-precision floating-point number to an equivalent 32-bit unsigned integer.

ToUInt32(Int16)

将指定的 16 位有符号整数的值转换为等效的 32 位无符号整数。Converts the value of the specified 16-bit signed integer to the equivalent 32-bit unsigned integer.

ToUInt32(Int32)

将指定的 32 位有符号整数的值转换为等效的 32 位无符号整数。Converts the value of the specified 32-bit signed integer to an equivalent 32-bit unsigned integer.

ToUInt32(Int64)

将指定的 64 位有符号整数的值转换为等效的 32 位无符号整数。Converts the value of the specified 64-bit signed integer to an equivalent 32-bit unsigned integer.

ToUInt32(Object)

将指定对象的值转换为 32 位无符号整数。Converts the value of the specified object to a 32-bit unsigned integer.

ToUInt32(Object, IFormatProvider)

使用指定的区域性特定格式信息,将指定对象的值转换为 32 位无符号整数。Converts the value of the specified object to a 32-bit unsigned integer, using the specified culture-specific formatting information.

ToUInt32(SByte)

将指定的 8 位有符号整数的值转换为等效的 32 位无符号整数。Converts the value of the specified 8-bit signed integer to the equivalent 32-bit unsigned integer.

ToUInt32(Single)

将指定的单精度浮点数的值转换为等效的 32 位无符号整数。Converts the value of the specified single-precision floating-point number to an equivalent 32-bit unsigned integer.

ToUInt32(String)

将数字的指定字符串表示形式转换为等效的 32 位无符号整数。Converts the specified string representation of a number to an equivalent 32-bit unsigned integer.

ToUInt32(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的 32 位无符号整数。Converts the specified string representation of a number to an equivalent 32-bit unsigned integer, using the specified culture-specific formatting information.

ToUInt32(String, Int32)

将指定基数的数字的字符串表示形式转换为等效的 32 位无符号整数。Converts the string representation of a number in a specified base to an equivalent 32-bit unsigned integer.

ToUInt32(UInt16)

将指定的 16 位无符号整数的值转换为等效的 32 位无符号整数。Converts the value of the specified 16-bit unsigned integer to the equivalent 32-bit unsigned integer.

ToUInt32(UInt32)

返回指定的 32 位无符号整数;不执行任何实际的转换。Returns the specified 32-bit unsigned integer; no actual conversion is performed.

ToUInt32(UInt64)

将指定的 64 位无符号整数的值转换为等效的 32 位无符号整数。Converts the value of the specified 64-bit unsigned integer to an equivalent 32-bit unsigned integer.

ToUInt64(Boolean)

将指定的布尔值转换为等效的 64 位无符号整数。Converts the specified Boolean value to the equivalent 64-bit unsigned integer.

ToUInt64(Byte)

将指定的 8 位无符号整数的值转换为等效的 64 位无符号整数。Converts the value of the specified 8-bit unsigned integer to the equivalent 64-bit unsigned integer.

ToUInt64(Char)

将指定 Unicode 字符的值转换为等效的 64 位无符号整数。Converts the value of the specified Unicode character to the equivalent 64-bit unsigned integer.

ToUInt64(DateTime)

调用此方法始终引发 InvalidCastExceptionCalling this method always throws InvalidCastException.

ToUInt64(Decimal)

将指定的十进制数的值转换为等效的 64 位无符号整数。Converts the value of the specified decimal number to an equivalent 64-bit unsigned integer.

ToUInt64(Double)

将指定的双精度浮点数的值转换为等效的 64 位无符号整数。Converts the value of the specified double-precision floating-point number to an equivalent 64-bit unsigned integer.

ToUInt64(Int16)

将指定的 16 位有符号整数的值转换为等效的 64 位无符号整数。Converts the value of the specified 16-bit signed integer to the equivalent 64-bit unsigned integer.

ToUInt64(Int32)

将指定的 32 位有符号整数的值转换为等效的 64 位无符号整数。Converts the value of the specified 32-bit signed integer to an equivalent 64-bit unsigned integer.

ToUInt64(Int64)

将指定的 64 位有符号整数的值转换为等效的 64 位无符号整数。Converts the value of the specified 64-bit signed integer to an equivalent 64-bit unsigned integer.

ToUInt64(Object)

将指定对象的值转换为 64 位无符号整数。Converts the value of the specified object to a 64-bit unsigned integer.

ToUInt64(Object, IFormatProvider)

使用指定的区域性特定格式信息,将指定对象的值转换为 64 位无符号整数。Converts the value of the specified object to a 64-bit unsigned integer, using the specified culture-specific formatting information.

ToUInt64(SByte)

将指定的 8 位有符号整数的值转换为等效的 64 位无符号整数。Converts the value of the specified 8-bit signed integer to the equivalent 64-bit unsigned integer.

ToUInt64(Single)

将指定的单精度浮点数的值转换为等效的 64 位无符号整数。Converts the value of the specified single-precision floating-point number to an equivalent 64-bit unsigned integer.

ToUInt64(String)

将数字的指定字符串表示形式转换为等效的 64 位无符号整数。Converts the specified string representation of a number to an equivalent 64-bit unsigned integer.

ToUInt64(String, IFormatProvider)

使用指定的区域性特定格式设置信息,将数字的指定字符串表示形式转换为等效的 64 位无符号整数。Converts the specified string representation of a number to an equivalent 64-bit unsigned integer, using the specified culture-specific formatting information.

ToUInt64(String, Int32)

将指定基数的数字的字符串表示形式转换为等效的 64 位无符号整数。Converts the string representation of a number in a specified base to an equivalent 64-bit unsigned integer.

ToUInt64(UInt16)

将指定的 16 位无符号整数的值转换为等效的 64 位无符号整数。Converts the value of the specified 16-bit unsigned integer to the equivalent 64-bit unsigned integer.

ToUInt64(UInt32)

将指定的 32 位无符号整数的值转换为等效的 64 位无符号整数。Converts the value of the specified 32-bit unsigned integer to an equivalent 64-bit unsigned integer.

ToUInt64(UInt64)

返回指定的 64 位无符号整数;不执行任何实际的转换。Returns the specified 64-bit unsigned integer; no actual conversion is performed.

TryFromBase64Chars(ReadOnlySpan<Char>, Span<Byte>, Int32)
TryFromBase64String(String, Span<Byte>, Int32)
TryToBase64Chars(ReadOnlySpan<Byte>, Span<Char>, Int32, Base64FormattingOptions)

适用于

另请参阅