1. attribute is always used to replace accessible data members.
2. readonly and const are preferred.
3. The as operator is preferred between as and forced type conversion.
4. Use the Conditional attribute (Conditional Attributes) to replace the Conditional compilation statement # if
5. Always reload the ToString method for the custom class
6. Differences between value types and reference types
7. Immutable Atomic Value Types)
8. In the value type, make sure that 0 is a valid data.
9. Understand the relationship between ReferenceEquals, static Equals, instance Equals and comparison operators (=)
10. Understand the defects of the GetHashCode Method
11. foreach is preferred when writing loops.
12. initialize the variable when defining it.
13. Use a static constructor to initialize static member variables
14. When multiple constructor functions are used, the constructor chain is used.
15. Use using and try/finally to release resources.
16. Avoid resource spam as much as possible
17. Avoid using boxing or unboxing)
18. Implement the Dispose method of the class
19. The interface is preferred between the interface and the Inheritance (Inheritance)
20. differentiate between interfaces and overloads)
21. Use a delegate to call back)
22. Use events to define External Interfaces
23. Avoid returning references from class members.
24. use metadata to control programs
25. The serializable type is preferentially used.
26. Implement IComparable and IComparer interfaces for objects to be sorted
27. Avoid using the ICloneable Interface
28. Avoid using the type conversion Operator
29. The new operator is required only when the base class has the same name as the existing function in the derived class.
30. Try to use CLS-Compliant
31. Try to write short and simple functions
32. Try to write a smaller assembly)
33. Define type visibility (visibility)
34. Compile a large-granularity web API
35. When using events, the base-class events are inherited first, instead of re-creating an event.
36. DEBUG (DEBUG, TRACE, EVENTLOG, etc.) when using the framework)
37. Use the. net standard configuration mechanism 38. Use and support the. net Data Binding function in the class)
39. Use the. net authentication mechanism (Validation)
40. Select the correct Collection class based on your needs)
41. Use DataSet in the Custom Structure
42. Attributes)
43. Do not over-use Reflection (Reflection)
44. Create a complete application-specific exception
45. Consider as many exceptions as possible and handle them.
46. Use Interop as few as possible
47. Try to use safe code)
48. Learn more and use external tools and resources
49. Prepare to use C #2.0.
50. Learn ECMA standards