The name of the Class Attribute starts with the first letter of the word in upper case. The private variable of the class is underlined with the first letter of the word in lower case. In this way, when we pass parameters in the method, the parameter variables can be named to start with the first letter of the word in lowercase, and the meaning of the parameter variables can be easily understood during the call, it does not conflict with private members of the class.
In addition to the control naming, the variable naming method does not use the Hungary naming method, but uses a more representative name for the variable. Adding lowercase abbreviations before control variables can effectively differentiate the control type.
All classes, methods, and attributes are annotated in XML format. This annotation can be used as a class library by inputting "//" in the first line of the declaration such as class or method to automatically generate the annotation format.ProgramYou can use the Class Library Attribute to generate the "XML document file", specify the document path for the output XML comment for the project, and use sandcastle to generate a document for the class library.
Try to encapsulate some common functional modules into classes and make them into different class libraries, generate xml annotations, and generate documents in chm format. In this way, you don't have to look for this module in the next time, as long as you reference the corresponding assembly, and. net IDE can read XML comments for you when you call classes in the class library. If you forget to read the CHM documentation. Over time, these dll will become a great fortune.
For and foreach I prefer. Written in foreachCodeAfter the block is decompiled into Il, you will find that the try block is added, and it is easy to see that the efficiency is slightly lower than.
Instead of using the "+" number to connect multiple strings, The stringbuilder append method is used to improve the efficiency. For more information about this issue, see. net installation.Article.
Although dataset is useful, I do not like dataset. Ado. Net hides an annoying secret: this amazing new technology is not applicable to all distributed applications. Dataset is very large. Poor use may lead to system slowdown and prone to concurrency conflicts.
The idispose interface must be implemented for classes that need to release resources, and the using statement block should be used to access resources. This facilitates garbage collection.
I like to use datareader and do not like to write all methods for accessing the database class as static. Although the proper use of static methods can improve the program running efficiency, in order to avoid unnecessary troubles caused by forgetting to close the database, I chose to implement the idispose interface and use the using block to access the database.