[Note] C # basic introduction -- C # naming rules for identifiers,

Source: Internet
Author: User

[Note] C # basic introduction -- C # naming rules for identifiers,

The variable name, constant name, class name, and method name in the program are calledIdentifier. C # There is a set of naming rules for Identifiers. If the naming rules are not followed, an error will occur. The rules are described as follows:

 

① An identifier can only consist of letters, numbers, and underscores. It cannot contain spaces or other characters.

Incorrect identifier declaration:

String $ user; // other characters are used when an error occurs.

② The variable name cannot start with a number.

Incorrect identifier declaration:

Double 6 h; // The error code starts with a number.

③ Keywords cannot be used as variable names.

Incorrect identifier declaration:

Char static; // an error occurs when the keyword static is used as the variable name.

The above is taken from MOOC course C # getting started with development

 

Related Article

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.