C #, the difference between String and string

  • String is a class, string is a data type.
  • c # is the string class, String class is .net Framework (not displayed in blue in the c # IDE)
  •  c # string mapped to .net Framework of String
  • If a string, the compiler will compile it into String, String so if you can make direct use of the compiler to do a little less work
  •  If you use c #, we recommend the use of string, more in line with norms  
  •  string always represent System.String (1.x) or :: System.String (2.0), String only in front using System; and when the current namespace is not the type called a String (class, struct, delegate, enum ) when it is on behalf of System.String
  • string is a keyword, not a String, that string can not be used as classes, structures, enumerations, fields, variables, methods, name of the property, and may String

Reproduced in: https: //www.cnblogs.com/zhangchenliang/archive/2011/05/24/2054989.html

Guess you like

Origin blog.csdn.net/weixin_33962923/article/details/93495611