Skip to content

In C#, When to use String verses string

Updated: at 02:12 PM

So, technically, String and string mean exactly the same thing in C#.  string, is an alias for String (aka a shorthand) for System.String.  So, when should use which?  It seems that the convention is to use string when you are referring to an object and String when you are referring specifically to the string class.

This is basically what is said at this URL:  http://en.csharp-online.net/CSharp_String_Theory%E2%80%94string_versus_String

Juval Lowy has some coding standards at http://www.idesign.net that says basically the same thing.  From the document on IDesign's web site the following examples show what is best practices (which I completely agree with).

idesign1                            idesign2

That's it for now. 

Check out the ORM (Object Relational Mapper) PRISMA. The database access method I use in all my projects