- Magic number/string
- If statement, you should always use single line or brackets
- Provide default value of Enum
- Difference between abstract class and interface
- Excess inheritance--the inheritance hierarchy is too deep
- Use string.Concat, string.Format, StringBuilder instead of +
- Const vs Readonly
- Break down large method into small methods
- Using nest class to hidden information is not necessary and hurts maintainability
- Do not use new keyword to hidden base class‘s method, please use polymorphism
- Static class may substitute singleton pattern for simplification
- Private members/property access are not necessary if not protecting; use auto properties instead
- Use IDisposable correctly to prevent resource leak for unmanaged resources.
- Tell browser the encoding you are using with meta tag
- Make sure browsers know you want to use edge rendering if you are building HTML5 websites
- Eliminating embedded javascript and style sheets to help improve caching of your code
- Use CDN so that browser caching can improve startup time for new users.
- Reduced round-trips with fewer CSS files means you are less likely to run into browser limits of CSS
- The less code inside a Razor file the better
- Creating cached objects inside per-request classes is not necessary and adds complexity
- Routing tables are still a valid way of doing routing for much your code
时间: 2024-11-15 22:48:57