UseConvertCommand to convert the display:
Command |
Result |
convert. toboolean ( Val ) |
Val convert to bool |
convert. tobyte ( Val ) |
Val convert to byte |
convert. tochar ( Val ) |
Val convert to char |
convert. todecimal ( Val ) |
Val convert to decimal |
convert. todouble ( Val ) |
Val convert to double |
convert. toint16 ( Val ) |
Val convert to short |
convert. toint32 ( Val ) |
Val convert to int |
convert. toint64 ( Val ) |
Val convert to long |
convert. tosbyte ( Val ) |
Val convert to sbyte |
convert. tosingle ( Val ) |
Val convert to float |
convert. tostring ( Val ) |
Val convert to string |
convert. touint16 ( Val ) |
Val convert to ushort |
convert. touint32 ( Val ) |
Val convert to uint |
convert. toyint64 ( Val ) |
Val convert to ulong |
The convert command must be used to display the strings provided by the conversion, which must be a valid expression of values and not overflow. The valid expression of a value is: an optional Symbol (+ or-), followed by a 0-or multi-digit word, followed by a single or multiple-digit word, next is an optional E or E, followed by an optional rich and one-or multiple-digit word (before or after this sequence) and space. With this optional additional data, we can see that a complex string such as-1.2564e-24 is a numerical value.
Note:ValIt can be various types of variables. If these commands cannot process these types of variables, the compiler will tell you
Table conversion names are slightly different fromC #Type name, because these commands come from. NET FrameworkOfSystemNamespace insteadC #Itself. In this wayC #Other. NetUse in compatible languages
One of the notes for these conversions is that they always need to perform overflow checks. The cheched and unchecked keywords and project property settings do not have any effect.