What is usage of #region and #undefine in C#.NET?Please by example
Printable View
What is usage of #region and #undefine in C#.NET?Please by example
I use #region all the time. it is a way to keep similar code blocks together. This is the way that I use it.
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.Code:#region Button Click Events
...... All of my button click events .....
#endregion
Won't MSDN have all the information that you are looking for?Quote:
Originally Posted by Abalfazl
Look at #undef
#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.