What's the difference between string and System.String?

What's the difference between string and System.String?

Rate This
  • Comments 10

C# defines a number of aliases for CLR types. They may be used interchangably, and even mixed together, e.g.

string x = new System.String(' ', 5);.

These are the aliases defined:

Alias CLR type
string System.String
sbyte System.SByte
byte System.Byte
short System.Int16
ushort System.UInt16
int System.Int32
uint System.UInt32
long System.Int64
ulong System.UInt64
char System.Char
float System.Single
double System.Double
bool System.Boolean
decimal System.Decimal

[Author: Jon Skeet]

Leave a Comment
  • Please add 3 and 2 and type the answer here:
  • Post
  • Are these aliases just like aliasing a type in the using statement?

    So in effect, I could create my own aliases that match VB.NET data types?

    using Byte = System.Byte
    using Short = System.Int16;
    using Integer = System.Int32;
    using Long = System.Int64;

    Not saying that I would want to, but hey you could, right? :p
  • I think that void is also System.Void, but it is not interchable in C#, isn't it?

  • bool System.Boolean
  • String s;
    DateTime dt;

    if (dt == null) // error, because DateTime is value type
    if (s == null) // ok (because reference type?)
    Response.Write(dt); // writes "01.01.0001 00:00:00"
    Response.Write(s); // writes "", although s=null, why?
  • PingBack from http://sharpcode.com.br/blogs/rafaelsilva/archive/2008/08/28/afinal-qual-a-diferen-231-a-de-string-e-string.aspx

  • Here is a post which explains the difference between a bool and a boolean

    http://dotnetrobert.com/?q=node/22

    Hope you find it useful.

  • DateTIme is a Struct!! (value type)... String is a Sealed Class, so you can use as a Object ;)

  • what is the differences between a string and a language?

  • string is like an alias/shorthand for System.String. Similarly, int is an alias/shosthand for System.Int16.

    www.jeeshenlee.com/.../difference-between-string-and.html

  • @williams Alkali: the same difference as the difference between a spoon and a matchbox :P

Page 1 of 1 (10 items)