Recommendation 2: use the default Transformation Method

Source: Internet
Author: User

In most cases, FCL should be used to convert the types provided by FCL (framework class library.

  • Use the type conversion operator.

That is, a method (function) inside the type is used. Conversion operators are classified into two types: implicit conversion and display conversion (forced conversion ). Primitive types (the data types directly supported by the compiler and directly mapped to the types in FCL) generally provide conversion operators.

  • Use the built-in parse, trypase, or methods such as tostring, todouble, and todatetime.
  • Use the methods provided by the help class.

You can use the system. Convert class and system. bitconverter class to convert types.

  • Use the transformations supported by CLR.

The transformation supported by CLR, that is, the upward and downward transformation, is actually the mutual conversion between the base class and the subclass. The base class to the base class can be implicitly converted, and the base class rotor class must be a display conversion.

Recommendation 2: use the default Transformation Method

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.