string is an alias in C# for System.String. Hence internally, there is no difference. It's like int vs. System.Int32. Even though both are same it's generally recommended to use string any time you're referring to an object.
e.g. string place = "test";
The only minute difference is that if you use the String class, you need to import the System namespace on top of your file, whereas it is not required to do so this when using the string keyword.
Many developers prefer to declare a string variable with string but use the String class when accessing one of its static members.
eg. String.Format()
We can also look at the two(string vs String) as below:
String --> Referring to a class
string --> Referring to the object
Following is the list of more aliases in C#:
object : System.Object
string : System.String
bool : System.Boolean
byte : System.Byte
sbyte : System.SByte
short : System.Int16
ushort : System.UInt16
int : System.Int32
uint : System.UInt32
long : System.Int64
ulong : System.UInt64
float : System.Single
double : System.Double
decimal: System.Decimal
char : System.Char
0 Comment(s)