Data Types and Naming Conventions in C#

(1) Data type

A.char: A single literal. Use paired single quotation marks. Limited to a single text. eg 'Han','A','2',

B.string string: Paired double quotes. 0 or more. " ", "Hello",

C.int: Integer, write directly.

D.double: write directly. There must be a decimal point. eg 0.0

(2) Variable naming convention

A. Cognitive Variables

A variable is a piece of memory space used to store data, and the variable name is the name given to this space. The contents of this memory area can vary.

B. Naming conventions

Hard requirements:

Variable names can only consist of numbers, letters, and underscores

It is wrong to not start with a number such as int 2number

Cannot be the same as keywords such as char and string. VS will report an error

Variable names in the same function cannot be the same.

Soft requirements:

CamelCase: start with the second word, capitalize the first letter

Wang Wenzhiyi: For example, to store a variable of height, you can name it: height

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325118869&siteId=291194637