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 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 didn'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.