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!
- String
Is a class, and string is a data type.
- String
Is a class in C #, string
Yes. NET Framework class (blue is not displayed in C # IDE)
- C # string
String mapped to. NET Framework
- 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.
- If C # is used, we recommend that you use string
.
- 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.
- 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