Exclusively for you!! Trial version of Google Apps, Apply Coupon-CNHPGX6T6QRWGV!!

Tip : Code Structure C#

bestpractice
bestpractice

Tip : Code Structure C#

As a developer, I always stress on developing a habit of following the best practices to structure the code. It helps me to easily navigate through the code and also saves a lot of effort in searching for some particular items.

Below is the sample structure and example:

using statements

Constants / Read-only fields

Private Members

Enumerations

Public members

Protected members

Constructors

Properties

Public methods

Private methods


//using statements

Using System

Using System.Web

namespace Controllers

{

public class SampleController

{

 

//Constants / Read-only fields

public const int numofitems=10;

//Private Members

private string _samplestring = string.Empty;

//Enumerations

public enum months

{

January = 1,

February,

March,

April,

May,

June,

July,

August,

September,

October,

November,

December

};

 

//Public members

public  int StartDate =string.Empty;

 

//Protected members

protected int EndDate ==string.Empty;

//Constructors

public SampleController ()

{

}

 

//Properties

public string Date { get; set; }

//Public methods

public string GetStartDate()

{

}

//Private methods

private int numOfItems()

{

}

 

 

Author: swatiS

Share This Post On

0 Comments

  1. nice superb explaination

    Post a Reply
  2. thanks for the tutorial
    I am having a problem.
    The feature “Create SQL server database” isn’t available , I can’t select it.
    Can you help, please ?

    Post a Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

More from CodeSpread: