Use the convert command in C # For explicit conversion

Source: Internet
Author: User

Command result
Convert. toboolean (VAR) VaR to bool
Convert. tobyte (VAR) VaR to byte
Convert. tochar (VAR) VaR to Char
Convert. todecimal (VAR) VaR to decimal
Convert. todouble (VAR) VaR to double
Convert. toint16 (VAR) VaR to short
Convert. toint32 (VAR) VaR to int
Convert. toint64 (VAR) VaR to long
Convert. tosbyte (VAR) VaR to sbyte
Convert. tosingle (VAR) VaR to float
Convert. tostring (VAR) VaR to string
Convert. touint16 (VAR) VaR to ushort
Convert. touint32 (VAR) VaR to uint
Convert. touint64 (VAR) VaR to ulong
Among them, Val can be various types of variables (if these commands cannot process these types of variables, the compiler will tell the user)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.