Posts Tagged ‘c#’

[C#] using region to make codes organized

Monday, June 8th, 2009

It’s hard to read codes if there are many methods and properties in the class. One way to ease the complexity is using comments like ‘here comes the public methods’. But not working well. There is a better way if you’re woking with C#. Using region.

#region makes it possible to bunddle asscociated codes. It does nothing except having codes block.

A good thing to use #region is you can use ‘outlining and hiding code’ funciton of visual studio. It is convinient when reading very complex codes.

class Region
{
  #region Fiels and Properties
  ...
  #endregion     

  #region Constructors
  ...
  #endregion     

  #region Public Methods
  #endregion     

  #region Private Method
  #endregion
}
Reblog this post [with Zemanta]