so what's the difference between string and System.String?

Well nothing really!!!

string is just a c# alias and System.String is a .NET type i.e. "string" is an alias for "String".

In the case of C#, these "built-in" types actually refer to types defined by the CLR. internally string is mapped to System.String.

Here we come to another interesting question. What about int? Will it run the same on all CPUs? (32 bit, 64 bit, etc.)

In fact it will. Because int is "ALWAYS" mapped to System.Int32, it will not matter what machine you are running the code on.

This can easily be verified by running the following code:


Below is a list of some of the aliases defined in the C# language.

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

So then if string is same as System.String and int is the same as System.Int32, then why have these aliases? Probably, a) Ease of use & b) they're simply short-forms--probably to ease the transition from C/C++ to C#