One of the questions that many novice C# programmers ask is: “What is the difference between string and String?”
In C#, string is an alias for the String class in .NET framework. In fact, every C# type has an equivalent in .NET. As another example, short and int in C# map to Int16 and Int32 in .NET.
So, technically there is no difference between string and String, but it is common practice to declare a variable using C# keywords. I’ve hardly seen anyone declaring an integer with Int32!
The only tiny 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 developers prefer to declare a string variable with string but use the String class when accessing one of its static members:
The examples on MDSN also follow this convention.Tags: csharp