C# Data types
C# is a Strongly typed language, Each value must be of datatype. It provides various Inbuilt data types to store different types of data.
| Datatypes | Description | Example |
|---|---|---|
| sbyte | Numeric type 1Byte Signed Number | sbyte num1=11 |
| short | Numeric type 2 Bytes Signed Number | short num=12 |
| int | Numeric type 4 Bytes Signed Number | int num1=311 |
| long | Numeric type 8 Bytes Signed Number | long num1=12l |
| byte | Numeric type 1 Byte unsigned Number | byte num1=33 |
| ushort | Numeric type 2 Bytes unsigned Number | ushort num=12 |
| uint | Numeric type 4 Bytes unsigned Number | uint num1=311 |
| ulong | Numeric type 8 Bytes unsigned Number | ulong num1=12l |
| float | Single precision floating Number | float price=1.12f |
| double | Double precision floating Number | double price=1.12d |
| bool | Boolean value of true or false | bool flag=true |
| decimal | Decimal Number with 28 digits | Decimal price=1.22M |
| char | Character represents Unicode or alphanumeric, special chars | char val=‘a’ |
| string | It is a group of Unicode characters, enclosed in double quotes | String str=“one” |
| object | Super base type to store all values | Object str=“one” |
Each of the above data types is an alias for the System type.
For example, int type is an alias for System.Int32 types