ASP.NET Coding Standards and Guidelines

ASP.NET Coding Standards and Guidelines

1. Prefix user control names with “uc”

2. The rest of the user control name should be in Pascal Casing (Ex. ucMyUserControl)

3. Do not use session variables throughout the code. Use session variables only within the classes and expose methods to access the value stored in the session variables.

4. Do not store large objects in session, it may consume lot of server memory depending on the number of users.

Continue reading “ASP.NET Coding Standards and Guidelines”

Database Coding Standards and Guidelines

Database Coding Standards and Guidelines

1. ANSI SQL 92 standards have to be followed for writing queries.

2. Do not put order by clause in the query unless required.

3. Do not encapsulate readonly database operations in transactions.

4. Use a stored procedure with output parameters instead of single record SELECT statements when retrieving one row of data.

5. Stored procedure execution is fast when we pass parameters by position (the order in which the parameters are declared in the stored procedure) rather then by name.

Continue reading “Database Coding Standards and Guidelines”

C# Coding Standards and Guidelines: Error Handling

C# Coding Standards and Guidelines: Error Handling

1. Error handler should be present whenever you anticipate possibility of error.

2. Do not use Try-catch for flow- control.

3. Never declare an empty catch block.

4. Error Message should be user friendly, simple and understandable.

Continue reading “C# Coding Standards and Guidelines: Error Handling”

C# Coding Standards and Guidelines: Comments

C# Coding Standards and Guidelines: Comments

1. All source code must include the following comments at the very top:

/********************************************************
*Author:
*Date:
*Description:
*Revision:
********************************************************/

2. All comments should be written in English(like in U.S. English).

3. Comments lines should begin with // indented at the same level as the code they are documenting.

4. Do not use /* … */ blocks for comments.

Continue reading “C# Coding Standards and Guidelines: Comments”

C# Coding Standards and Guidelines: Coding Practices

C# Coding Standards and Guidelines: Coding Practices

1. Use meaningful namespace such as the product name or the company name.

2. Avoid fully qualified type names. Use the using statement instead.

3. Avoid putting a using statement inside a namespace.

4. Group all framework namespaces together and put custom or third-party namespaces underneath.

Continue reading “C# Coding Standards and Guidelines: Coding Practices”