String vs string [duplicate]

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

Should I use string or String when declaring a basic string variable in c# and does it matter?


Solution 1:

I like string because VS highlights it in dark blue (which makes it awesomer).

Solution 2:

It doesn't matter, though it's best to be consistent: lower-case string is an alias for String.

Solution 3:

The string keyword is an alias for System.String.

(The same goes for int - System.Int32 long - System.Int64 and so on)

C# doesn't have two different representations for primitives the same way that Java does. (Where an int is far different from an Integer)

In most cases it is best to use lowercase string because it is an alias to the fully qualified System.String. This way you can avoid type conflicts if there is another String type somewhere in your code.