Tuesday, July 05, 2005

The string type represents a string of Unicode characters. string is an alias for System.String in the .NET Framework. C# defines a number of aliases for CLR types which can be used interchangably or even mixed together.

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

Although string is a reference type, the equality operators (== and !=) are defined to compare the values of string objects, not references. This makes testing for string equality more intuitive.

Some more defined C# aliases are:

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
posted on Tuesday, July 05, 2005 7:49:00 PM (Central Standard Time, UTC-06:00)  #    Comments [0] Trackback