Home >Backend Development >C#.Net Tutorial >Detailed explanation of the four basic data types of C#
This article mainly introduces the relevant knowledge of the four basic data types of C#, which has a good reference value. Let’s take a look at it with the editor.
Character type char, stores a character enclosed in '' (single quotes), for example:
char sex='男';//存储性别
StringTypestring, stores a string of characters enclosed in "" (double quotes), for example:
string address="北京市宣武区牛街北口";//存储地址
Integer type int, stores Integers, for example:
int age=23;//存储年龄
Double precisionFloating point type double, store decimals, for example:
double salary=7991.63;//存储工资
The above four are the most commonly used data types.
It should be noted that a certain type of variable can only store this type of data, otherwise, an error may occur.
The above is the detailed content of Detailed explanation of the four basic data types of C#. For more information, please follow other related articles on the PHP Chinese website!