Question: **Note**: This "feature" has now been added to Visual Studio 2015 but the question will hold a while since not every developer or every dev shop gets access to the latest and greatest IDE as soon as it comes out.

**ORIGINAL QUESTION:**

Normally I wouldn't "need" or even consider a ridiculous feature such as code regions within method bodies but: I'm refactoring VB.NET code where methods routinely run five hundred lines of code or more and the references are so tightly coupled that the code defies simple refactoring such as method extraction. 

And that's why I thought I would try regions within a method body. I just wanted to organize the code for the short term. But the IDE doesn't let me (resulted in a compiler error.) I'm just curious as to why? Seems like code regions shouldn't impact the compiler, intellisense etc. Am I missing something? (Still using VS 2005 btw.)

**Interesting:** This seems to be language specific. It's OK in C# (I didn't check that initially) but not in VB.NET.

```
public module MyModule
    Sub RunSnippet()
        dim a as A = new A (Int32.MaxValue )

        #region 
        Console.WriteLine ("")
        #end region
       ....

```

that gets a compiler error but the C# version is ok.

Answer: 
For anyone looking for the most recent answer to this question, this is now possible in VB.NET (starting from [version 14](https://github.com/dotnet/roslyn/wiki/New-Language-Features-in-VB-14#minor-features-and-fixes) on).

> 
> **Region Directives inside Method Bodies**
> 
> 
> You can put #Region…#End Region delimiters anywhere in a file, inside functions, and even spanning across function bodies.
> 
> 
> 

The example from the OP is now perfectly legal syntax:

```
Sub RunSnippet()
    Dim a as A = New A (Int32.MaxValue )

    #Region "Test"
    Console.WriteLine ("")
    #End Region
End Sub

```
*Visual Studio 2003* had them for VB.NET, but feature was removed in *Visual Studio 2005* and later. Really annoying when refactoring large procedures, yet you can split the code window.

Honestly, I wish C# would restrict region use because they are overly used. I have a macro that strips them out of all code files when inheriting C# projects.

Another feature removed was the list of overridable methods in the *Navigation Bar*. I check to see if they re-added this feature for every new version of *Visual Studio* since 2005.