CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2005
    Posts
    98

    Usage of #region ,#undefine

    What is usage of #region and #undefine in C#.NET?Please by example

  2. #2
    Join Date
    Nov 2007
    Location
    .NET 3.5 / VS2008 Developer
    Posts
    624

    Re: Usage of #region ,#undefine

    I use #region all the time. it is a way to keep similar code blocks together. This is the way that I use it.

    Code:
    #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.

  3. #3
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: Usage of #region ,#undefine

    Quote Originally Posted by Abalfazl
    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

  4. #4
    Join Date
    Mar 2004
    Location
    33°11'18.10"N 96°45'20.28"W
    Posts
    1,808

    Re: Usage of #region ,#undefine

    #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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured