views:

202

answers:

4

Possible Duplicate:
String vs string in C#

What is the difference Between String and string or Double and double?

if i use :

double s1; or

if i use Double s1;

can you give pros and cons?

+10  A: 

string is just the C# alias for the System.String class. The same is true for all the other built-in language types like:

  • int (System.Int32)
  • float (System.Single)
  • double (System.Double)
  • decimal (System.Decimal)
  • bool (System.Boolean)
  • and so on...

As far as usage conventions go, I completely agree with this answer on SO.

Related resources:

Enrico Campidoglio
And `double` is an alias for `System.Double`.
Jonas Elfström
+1  A: 

See : string (Référence C#)

According to MSDN :

The string type represents a sequence of zero or more Unicode characters. string is an alias for String in the .NET Framework.

In short, no difference, as one is a sugar syntax for the other.

Will Marcouiller
you linked to the French language version of MSDN :P
Lucas
Thanks for mentionning it! =) I changed the link for the English one.
Will Marcouiller
+1  A: 

string or String is CLR aliases for System.String

aleo
+3  A: 

string is an alias for System.String. It doesn't matter whether you use String or string. It's in the end translated into System.String anyway.

It's the same case as with System.Int32 and int etc.

Here is the list of all aliases.

Ondrej Slinták