Saturday, June 8, 2013

Top 10 C# Guidelines and Code reviews checklist for Developers


This is a General Code Review checklist and guidelines for C# Developers, which will be served as a reference point while development. This is to ensure that most of the General coding guidelines have been taken care of, while coding. Especially, it will be very helpful for entry-level and less experienced developers (0 to 3 years exp.) to refer this checklist until it becomes a habitual practice for them.

Complete checklist reference

This is only Top 10 checklist items. If you are interested to have a look at the complete list (around 40 items) please visit here:


1. Make sure that there shouldn't be any project warnings.

2. It will be much better if Code Analysis is performed on a project (with all Microsoft Rules enabled) and then remove the warnings.

3. All unused usings need to be removed. Code cleanup for unnecessary code is always a good practice.

4. 'null' check need to be performed wherever applicable to avoid the Null Reference Exception at runtime.

5. Naming conventions to be followed always. Generally for variables/parameters follow Camel casing and for method names and class names follow Pascal casing.

6. Make sure that you are aware of SOLID principles.

Definition from Wikipedia: In computer programming, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Michael Feathers for the "first five principles" identified by Robert C. Martin[1][2] in the early 2000s[3] that stands for five basic principles of object-oriented programming and design. The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time.[3] The principles of SOLID are guidelines that can be applied while working on software to remove code smells by causing the programmer to refactor the software's source code until it is both legible and extensible. It is typically used with test-driven development, and is part of an overall strategy of agile and adaptive programming.

7. Code Reusability: Extract a method if same piece of code is being used more than once or you expect it to be used in future. Make some generic methods for repetitive task and put them in a related class so that other developers start using them once you intimate them. Develop user controls for common functionality so that they can be reused across the project.

8. Code Consistency: Let's say that an Int32 type is coded as int and String type is coded as string then they should be coded in that same fashion across the application. But not like sometimes int and sometimes as Int32.

9. Code Readability: Should be maintained so that other developers understand your code easily.

10. Disposing of Unmanaged Resources like File I/O, Network resources, etc. They have to be disposed of once their usage is completed. Use usings block for unmanaged code if you want to automatically handle the disposing of objects once they are out of scope.



I welcome feedbacks, queries, and suggestions from the readers so that I can improve it further and developers should get some benefit out of it. My aim is to gradually make it a complete Code review guidelines especially for C# developers and in next version I'm planning to add supporting code examples and screenshots for much better understanding purpose.
Disclaimer: This document does not guarantee that all the mentioned guidelines and practices are applicable as of today. Therefore it is always recommended to check yourself MSDN, discuss with experts and check other portals for the current and modified guidelines and practices. Also, note that some of the provided reference links might not work.

Saturday, February 9, 2013

Online File Extension Identifier

Today, I tried to open a file which I received through email from some company. First I downloaded the file, after that tried to open it but it wasn't opening as the file does not have any extension.

I tried to open it from 'Open With' option and checked by selecting word, excel, rar, zip, etc but no luck. Then I right clicked the file and checked the details, unfortunately, no details available and no information on extension available. Finally, I started googling by typing this phrase: 'if file type is file how to open'. In the first page results I found an interested link: I opened this site and just given my file local path and clicked on Analyze button and hurray within a second in the below grid I got the file information. The extension was PDF...

What an experience it was...It was very helpful because I didn't had much time to contact the sender and enquire about the file type through email :)

Thursday, November 29, 2012

Automating Deployment with Microsoft Web Deploy

What is exception bubbling in C#?

Click here for details: What is exception bubbling in C#?

Learn .NET in 60 days series (playlist)

Good News: Introducing

My blog URL is too long (, isn't it?

Yes, that's even hard to remember :)

So to keep it simple and easy to remember, introducing a new URL (alias):

One stop place for c# ,.NET , SQL Server common questions

Visit this site which gives you some of the typical questions and answers.

Saturday, November 24, 2012

Today attended MUGH Developer Day Event - Nov 2012

Today attended MUGH Developer Day Event - Nov 2012.

1.  Windows Azure offerings (IaaS,PaaS,Saas) by Krishnachaitanya.
2.  .NET evolution and new features in 2010/2012 by Chakravarthy.