Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the naming convention for VB.NET methods and attributes

Shulou Source: shulou.com Published: 2022-06-02 08:50:16 09月10日 Update

This article mainly introduces the VB.NET method and attribute naming rules, the article is very detailed, has a certain reference value, interested friends must read it!

1. Methods

Whether it is a function or a subroutine, the method must be named after a verb or verb phrase. There is no need to distinguish between functions and subroutines, and there is no need to specify the return type.

Sub Open (ByVal CommandString

As String)

Function SetCopyNumber

(ByVal CopyNumber As Integer)

The parameter needs to specify whether ByVal or ByRef, which makes the side of the program long when written, but it is necessary. If there are no special cases, use ByVal. For the naming method of parameters, refer to the following "naming method of variables". Methods that need to be overloaded, generally do not write Overloads, and write overloaded methods as needed.

2. Attributes

In principle, a field (Field) cannot be exposed, and properties are generally used to access the value of the field. The attribute is named after a concise and clear noun:

Property Concentration As Single Property Customer As CustomerTypes

3. Events

Events are special properties that can only be used in the context of event handling. The principle of naming is generally the verb or the participle of the verb, indicating the time of the event through tenses:

Event Click As ClickEventHandler

Event ColorChanged As

ColorChangedEventHangler

The above is all the content of the article "what are VB.NET methods and attribute naming rules?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Methods properties events verbs rules content functions principles parameters subroutines fields articles or references special concise necessary upper and lower context value Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Linux Shulou Information Redmi Apple