Possible Duplicate:
In C# what is the difference between String and string
I couldn't find the info anywhere, but I'm sure it's just a simple answer. Are they interchangeable??
Possible Duplicate:
In C# what is the difference between String and string
I couldn't find the info anywhere, but I'm sure it's just a simple answer. Are they interchangeable??
Yes, they are identical. string
is just the C# name for a System.String
, which you can also use. See MSDN:
The string type represents a string of Unicode characters. string is an alias for System.String in the .NET Framework.
It's personal preference, but I always use string
over String
. I guess I like the blue color over the, uh, turquoise color offered by the default syntax highlighting.
You can see the other aliases under the C# value types on MSDN (e.g. int
is really System.Int32
while long
is really System.Int64
).
You get this question a lot because in java there is a difference between for example Integer and int (pointer allocation). In C# there is no difference between String and string, nor there is a difference between Int32 and int etc..