Like many new C# programmers, one question I asked was “What is the difference between string and String in C#?”
Difference between string and String
Technically there is no difference between string and String. string keyword is an alias for the String class in .NET Framework. It’s like int and System.Int32.
string msg="Hello World"; String msg1="Hello World";
Also, string provides limited functionality. Whereas, System.String class comes with a couple of functions such as Format(), Compare() … and properties to manipulate the string.
If you need to use String class, you need to import the System namespace to your code.
Join the newsletter to get the latest updates.