Difference between string and String in C#

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.

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.

If you enjoyed this post, let me know by leaving a comment below.


Leave a Reply

Your email address will not be published.Required fields are marked *