Built-in types table
Domains:
C#
The following table shows the keywords for built-in C# types, which are aliases of predefined types in the System namespace.
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 |
Remarks
All of the types in the table, except object
and string
, are referred to as simple types.
The C# type keywords and their aliases are interchangeable. For example, you can declare an integer variable by using either of the following declarations:
int x = 123;
System.Int32 y = 123;
Use the typeof operator to get the System.Type instance that represents the specified type:
Type stringType = typeof(string);
Console.WriteLine(stringType.FullName);
Type doubleType = typeof(System.Double);
Console.WriteLine(doubleType.FullName);
// Output:
// System.String
// System.Double