Click to See Complete Forum and Search --> : Usage of #region ,#undefine


Abalfazl
May 3rd, 2008, 08:32 AM
What is usage of #region and #undefine in C#.NET?Please by example

eclipsed4utoo
May 3rd, 2008, 09:03 AM
I use #region all the time. it is a way to keep similar code blocks together. This is the way that I use it.

#region Button Click Events

...... All of my button click events .....

#endregion

It will now allow me to collapse all of the button click events into one line. For me, it helps keep the code looking cleaner.

Shuja Ali
May 3rd, 2008, 12:25 PM
What is usage of #region and #undefine in C#.NET?Please by example
Won't MSDN have all the information that you are looking for?

Look at #undef (http://msdn.microsoft.com/en-us/library/wkxst87d(VS.80).aspx)

MadHatter
May 3rd, 2008, 10:33 PM
#region is a code view only decoration that is used by coders who write bloated code.

I cringe most times I see them used because its typically used to collapse hundreds of lines of useless code.