2.6 C # identifier naming conventions

Source: Internet
Author: User

naming rules for C # identifiers

The variable name, constant name, class name, and method name in the program are called identifiers . C # has a set of naming rules for identifiers, and errors occur if you do not follow the rules when naming them. This set of rules is simply said to have the following three articles:

① identifiers can only be made up of English letters, numbers, and underscores, and cannot contain spaces and other characters.

Incorrect identifier declaration:string $user; //错在使用了其他字符

The ② variable name cannot begin with a number.

Incorrect identifier declaration:double 6h;//错在用数字开头

③ cannot use keywords as variable names.

Incorrect identifier declaration:char static ;//错在用关键字static做变量名

2.6 C # identifier naming conventions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.