1, for the common type definition, to be extracted separately, put in a separate DLL. 2, through a large number of definitions interface interface, to improve the degree of modularity, different functions through the implementation of interfaces to interface programming. 3, if there are many very similar in the project, but there are some differences in the class, the best way is to further abstract, get their common base class, the same point in the base class implementation, and then implement the differences through derived classes. The user decides which class to use according to the actual situation. 4, the project, often encounter some global scope has only one instance of the class, how to do? At this point, be sure to remember the singleton mode. Defines a class that only opens a static method, getinstance, that either returns an instance that has already been created, or creates a new one that returns its reference. 5, for exception capture, it is good practice not to put all the code in Try-catch, it is good practice to just put the necessary code, and the code that may appear exception, and in order to avoid the uncaught exception cause the program to quit unexpectedly, You need to add code in the program that captures unhandled exceptions, and you should also differentiate between UI and worker threads that can produce unhandled exceptions, which should both be captured and processed (logged to the log). 6, for the use of This.invoke forwarding worker thread processing results, or processing of intermediate state information, there is no need to add try-catch. If you want to add, you only need to add to invoke after. 7, sometimes, the interface may exist at design time and run-time state is not the same, please think of designmode properties. 8, basically, each project will involve some of the system's operational parameters of the serialization problem. Two common processing scenarios: 1, use INI to save. 2, you can write a class, use static properties to save all settings, and then provide the Save method, the Load method, the reload method, and then serialize the values into a binary file.
Some experience sharing in C # when doing projects