The conversion type is to convert one data type to another. The type of casting is also known. C# has two kinds of casting In C# -
These conversions are carried out in a safe and typical way with C#. Conversions from smaller to bigger integrated types and conversions from derived classes to basic classes, for instance.
Users use the pre-defined features for these conversions. Cash operators must be explicitly converted.
The following built-in conversion techniques are provided in C#.
Methods | Description |
---|---|
ToBoolean | Conversion of a type to a Boolean value, wherever possible. |
ToByte | Conversion of a type to a byte. |
ToChar | Conversion of a type to a single Unicode character, wherever possible. |
ToDateTime | Conversion of a type to a date-time structures. |
ToDecimal | Conversion of a floating or integer type to decimal. |
ToDouble | Conversion of a type to a double. |
ToInt16 | Conversion of a type to a 16-bit integer. |
ToInt32 | Conversion of a type to a 32-bit integer. |
ToInt64 | Conversion of a type to a 64-bit integer. |
ToSbyte | Conversion of a type to a signed byte type. |
ToSingle | Conversion of a type to a small floating point value. |
ToString | Conversion of a type to string. |
ToType | Conversion of a type to some specified type. |
ToUInt16 | Conversion of a type to an unsigned int value. |
ToUInt32 | Conversion of a type to an unsigned long value. |
ToUInt64 | Conversion of a type to an unsigned big integer. |
|