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.

DatatypesDescriptionExample
sbyteNumeric type 1Byte Signed Numbersbyte num1=11
shortNumeric type 2 Bytes Signed Numbershort num=12
intNumeric type 4 Bytes Signed Numberint num1=311
longNumeric type 8 Bytes Signed Numberlong num1=12l
byteNumeric type 1 Byte unsigned Numberbyte num1=33
ushortNumeric type 2 Bytes unsigned Numberushort num=12
uintNumeric type 4 Bytes unsigned Numberuint num1=311
ulongNumeric type 8 Bytes unsigned Numberulong num1=12l
floatSingle precision floating Numberfloat price=1.12f
doubleDouble precision floating Numberdouble price=1.12d
boolBoolean value of true or falsebool flag=true
decimalDecimal Number with 28 digitsDecimal price=1.22M
charCharacter represents Unicode or alphanumeric, special charschar val=‘a’
stringIt is a group of Unicode characters, enclosed in double quotesString str=“one”
objectSuper base type to store all valuesObject 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