C # differences between string and string

Source: Internet
Author: User
Although this problem is relatively simple, I still have a thick face, sunglasses, a beard, and a cigar! I wrote this article... and I still hope that my weak behavior will help some people. (Note: You can shoot bricks, don't shoot your face !!

)

The following is my understanding!
  1. String
    Is a class, and string is a data type.
  2. String
    Is a class in C #, string
    Yes. NET Framework class (blue is not displayed in C # IDE)
  3. C # string
    String mapped to. NET Framework
  4. If you use string
    , The compiler will compile it into a string
    So if you use string directly, you can make the compiler do less work.
  5. If C # is used, we recommend that you use string
    .
  6. String
    Always stands for system. String (1.x) or: system. String (2.0), string
    System. String is represented only when there is a using system; in the namespace and there is no string type (class, struct, Delegate, Enum) in the namespace.
  7. String
    Is a keyword, string is not, that is, string
    It cannot be the name of a class, structure, enumeration, field, variable, method, or attribute.
    Yes
Additional: C # defines the CLR type alias. They can be exchanged and used, or even mixed together, for example, string x = new system. String ('', 5 );. The following are some defined aliases: alias CLR type string system. String
Sbyte system. sbyte
Byte system. byte
Short system. int16
Ushort system. uint16
INT system. int32
Uint system. uint32
Long system. int64
Ulong system. uint64
Char system. Char
Float System. Single
Double system. Double
Bool system. Boolean
Decimal System. Decimal





 

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.