C Sharp

Types and Aliases

While the CTS is responsible for defining the types that can be used across .NET languages, most languages choose to implement aliases to those types. For example, a four-byte integer value is represented by the CTS type System.Int32. C# then defines an alias for this called int. There is no advantage to using one technique over the other. Table 4-3 lists the different CTS types and their C# aliases.

Table 4-3 CTS Types and Aliases-

CTS Type Name
C# Alias
Description
System.Object
object
Base class for all CTS types
System.String
string
String
System.SByte
sbyte
Signed 8-bit byte
System.Byte
byte
Unsigned 8-bit byte
System.Int16
short
Signed 16-bit value
System.UInt16
ushort
Unsigned 16-bit value
System.Int32
int
Signed 32-bit value
System.UInt32
uint
Unsigned 32-bit value
System.Int64
long
Signed 64-bit value
System.UInt64
ulong
Unsigned 64-bit value
System.Char
char
16-bit Unicode character
System.Single
float
IEEE 32-bit float
System.Double
double
IEEE 64-bit float
System.Boolean
bool
Boolean value (true/false)
System.Decimal
decimal
128-bit data type exact to 28 or 29 digits-mainly used for financial applications where a great degree of accuracy is required

by BrainBellupdated
Advertisement: