Wednesday, June 13, 2012

Coding Stander For C#


1. Be sure Dispose() gets called on IDisposable objects that you create locally within a method. This is most commonly done in the finally clause of a try block. It’s done automatically when a using statement is used.

2. Prefer while and foreach over other available looping constructs when applicable. They are logically simpler and easier to code and debug.

3. Classes should be organized into regions within an application using a layout determined by your application architect.
These may be based on accessibility,  type or functionality. Consult your architect for the layout strategy used in your
application.

Example:

// Class layout based on accessibility
class Purchasing
{

#region Main

#region Public

#region Internal

#region Protected

#region Private

#region Extern

#region Designer Generated Code

}


                                     OR                                        

// Class layout based on accessibility
class Purchasing
{

#region Property

#region Events

#region  Methods
}


SQL Optimization

  SQL Optimization  1. Add where on your query  2. If you remove some data after the data return then remove the remove condition in the sel...