Windows Phone Developers

Sunday, March 28, 2010

How to effectively use #region in Visual Studio

#region lets you specify a block of code that you can expand or collapse when using the outlining feature of the Visual Studio Code Editor.

The collapse and expand feature can be used for advantage with good declaration of regions

For example:


namespace BlogExample_WinAppOne
{
class ClassTeam
{
#region declarations
public enum playerType { ClassA, ClassB, ClassC, Contract }
#endregion

#region properties
public playerType PlayerType
{
get { return PlayerType; }

set
{
PlayerType = value;
}

}


#endregion

#region public methods
public string SetPlayer
{

}
#endregion
}
}



Would look like the following when collapsed:




Please share your thoughts on effective usage of #region Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment

kbAlertz.com :: Visual Studio 2005

kbAlertz.com :: Visual Studio 2008

kbAlertz.com :: Visual Basic 2005