string is an alias for String in the .NET Framework.
Where "String" is in fact System.String.
I would say that they are interchangeable and there is no difference when and where you should use one or the other.
It would be better to be consistent with which one you did use though.
For what it's worth, I use string
to declare types - variables, properties, return values and parameters. This is consistent with the use of other system types - int, bool, var
etc (although Int32
and Boolean
are also correct).
I use String when using the static methods on the String class, like String.Split()
or String.IsNullOrEmpty()
. I feel that this makes more sense because the methods belong to a class, and it is consistent with how I use other static methods.