Home  >  Article  >  Backend Development  >  Detailed explanation of the four basic data types of C#

Detailed explanation of the four basic data types of C#

黄舟
黄舟Original
2017-03-16 13:15:361398browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn