Many C# programmers ask is: “What is the difference between string and String?” Basically string is an alias in C# for System.String. So technically, there is no difference.
In simple words, “string” is a datatype, whereas “String” represents a class. As far as guidelines, it’s generally recommended to use string any time you’re referring to an object.
There is another small difference is that if you use the String class, you need to import the System namespace on top of your file, whereas you don’t have to do this when using the string keyword.
Many C# programmers ask is: “What is the difference between string and String?” Basically string is an alias in C# for System.String. So technically, there is no difference.
In simple words, “string” is a datatype, whereas “String” represents a class. As far as guidelines, it’s generally recommended to use string any time you’re referring to an object.
There is another small difference is that if you use the String class, you need to import the System namespace on top of your file, whereas you don’t have to do this when using the string keyword.
Example,
need an explanation for this answer? contact us directly to get an explanation for this answer