The build – in data types are aliases of types originally defined in the .NET class library. These types and the corresponding .NET types are below: -
C# Type .NET Type
bool System.Boolean
byte System.Byte
sbyte System.SByte
char System.Char
decimal System.Decimal
double System.Double
float System.Single
int System.Int32
uint System.UInt32
long System.Int64
ulong System.UInt64
object System.Object
short System.Int16
ushort System.UInt16
string System.String
The word Object is a class in the .NET class library. It represents the root of all types. Needless to say, we can use either the C# type or the .NET type in our code. For example, the following two statements are equivalent; they both declare an integer variable and assign the value 25 to it:
int myInt = 25;
System.Int32 myInt = 25;
The following two statements are also equivalent; both declare a variable of the object type:
object myObject;
System.Object myObject;
All types except the string and object types are called simple data types.
Tuesday, March 16, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment