The difference between a C # string and a string

Source: Internet
Author: User

both string and string exist in C #

Description of string in MSDN:

string is a alias for string in the. NET Framework. String is a string alias, string is a class in C #, string is the class of the framework, and C # string is mapped to a string of the framework. If a string is used, the compiler compiles it into a string, so the compiler can do a little bit less work if you use string directly.

If you use C #, it is recommended that you use string to compare to specifications. String always represents System.String (1.x) or:: System.String (2.0), string is only preceded by using System, and there is no type named string in the current namespace (class, struct, delegate, enum) is only representative of System.String.

      • String is a class in C #, and string is a class of the. NET Framework (does not display blue in the C # IDE)
      • C # string mapped to a string of the. NET Framework
      • If a string is used, the compiler compiles it into a string, so the compiler can do a little bit less work if you use string directly
      • If you use C #, we recommend that you use string to compare compliance
      • String always represents System.String (1.x) or:: System.String (2.0), string is only preceded by using System, and there is no type named string in the current namespace (class, struct, delegate, enum) is only representative of System.String
      • String is a keyword, string is not, that is, string cannot be the name of a class, struct, enumeration, field, variable, method, property, and string can

Reference Address: http://www.cnblogs.com/albertly/archive/2008/11/18/1335823.html

The difference between a C # string and a string

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.