+ 12

What are the differences between "string" and "String"?

I'm just wandering that a string with big 'S' and a string with small 's' are both accepted in c#. Are they really the same or different?

5th Mar 2017, 5:03 AM
Jayson Ondiano
Jayson Ondiano - avatar
2 Respostas
+ 13
"String" and "string" both refer to the same thing so they aren't different from each other, but some people prefer to use the one and others prefer the other. Performance wise they aren't different, so it's mainly what you prefer to do.
5th Mar 2017, 9:26 AM
ChessMaster
ChessMaster - avatar
+ 12
As a guidline, use string when creating a variable and String when referring to the String class. e.g. string s = String.Concat("Hello ", "World"); Source: http://stackoverflow.com/a/7077
6th Mar 2017, 9:31 PM
Jafca
Jafca - avatar