In C # what is the difference: string vs String

Possible duplicate:
In C # what is the difference between string and string

In C # there is string and there is System.String .

What is the difference between the two? It is considered better to use this other. Are there any hidden dangers when mixing their use?

If they are the same, then why are they both? Why not just one or the other?

+4
source share
4 answers

System.String is the name of the real CLR.NET class, just as System.Int32 is the real name of this class. But C # developers wanted it to be very similar to C and C ++, where the native types (e.g. int ) are in lower case, so they added aliases for the main native types.

+6
source

There is no difference.

http://msdn.microsoft.com/en-us/library/362314fe.aspx

A string type is a sequence of zero or more Unicode characters. string is an alias for String in the .NET Framework.

+5
source

No difference string is an alias for String. See here

For more information, see the following sections in the C # Language Specification :

2.4.2 Identifiers

2.4.4.5 String literals

4.2.3 String Type

7.9.7 String Equality Operators

+4
source

string is just an alias for System.String

+3
source

Source: https://habr.com/ru/post/1300935/


All Articles