Last few days I was to code review one of our sharepoint projects. Actually there is nothing for review because almost all the pages are developed by MS Developers and only we are customizing it. But I have to do the job and it give me some good experiences.
Lessons learned from Code review.
- Always dispose objects, when you are not using it.
- Use string.Compare instead of using ToUpper() and “==” combination for string evaluation
- Avoid direct casting, instead of use “as” operator
- Try to use “using” code block, if the class implements “IDisposible” interface
- Always close Database connections, before disposing it.
Here is the few things I learned in the code review session.