INTROUND: VB.NET as one of the main languages of .NET, in the era of object-oriented technology, it has been given new significance, and VBs who have been disdainted by the professional program designer have the first time, which can be completely infinite. C / C or C # or Java is comparable! As a fan of VB / VB.NET (developer), it is necessary to make full use of VB.NET brings us the endless energy, it will abandon the attitude of "put", in-depth research, Since I am not the so-called "expert", if I have something wrong, I sincerely refer. Text: Everyone may want: For a person who has learned any programming language, like constant, variable, etc. It should be familiar with it, but is it true? This article will discuss the use of VB.NET variables on the naming rules of the variable, the scope and the survival period.
Part 1: Naming rules of variables are variable naming rules? Variable naming rules are to let code more easy to read and maintain management, the naming standards written by the program, which will be introduced in Microsoft's recommended naming rules. General Variables should follow the following naming rules: Range Data Type ID Name where the range represents the scope of the variable, if the public variable uses lowercase G represents (Global), local variables omit omitted; data type is like Integer Sword-written three-code bookmarks such as String. The three code books containing the sample data type are listed below for the reference. Data type abbreviation example byte byt bytcount boolean bln byt Bytcount Boolean Bln BySMALE INTEGER INT INTAGON SNG LNGNUMBER SINGL SNGTAX DOUBLE dbl dblIncome Short shr shrEnployeeNumber Decimal dec decIncome Date dat datMyBirthday Object obj objConn String str strMyName Stucture udt udtMyStructure Note: udt is the English user define type of shorthand name identification: the main variables, it is recommended to use the English case mix, and is easy to remember, It is possible to represent the name of the variable. Of course, the premise is that the identification name must be legitimate (what is the legal name, please refer to other information), is the name MyName (according to the naming rule is strmyname). According to the variable data type To name a variable, it is the easiest judgment method that distinguishes professional and amateur programming. Home can consciously cultivate the habit of declaring variables using these naming norms.