Naming rules: Class-class

Source: Internet
Author: User

The following rules give an overview of the class naming rules:

  • Use a noun or noun phrase to name a class.
  • Use Pascal case.
  • Avoid abbreviations.
  • Do not use the type prefix. For example, use the C prefix before the class. For example, use the class name filestream instead of cfilestream.
  • Do not use underscores (_).
  • Occasionally, even if a class is not an interface, you must provide a class name starting with the letter I. As long as I is the first letter of a class name word, this is acceptable. For example, the class name identitystore is acceptable.
  • Use composite words to name the derived class. The second part of the derived class should be the name of the base class. For example, applicationexception is suitable for the name of a class derived from the class named exception because applicationexception is a type of exception. Make reasonable judgments when using this rule. For example, a button is a proper name for a class derived from a control. Although a button is a type of control, using control as a class name will make the class name grow unnecessary.

The following is an example of a correct naming class.

[Visual Basic]

Public class filestreamclass filestream
Public class buttonclass button
Public class stringclass string

[C #]

Public class filestream
Public class button
Public class string

Original article: Class naming guidelines

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.