C# regions

I really HATE regions in C# code. What they actually do is only hide the whole blocks of code. You don't see the entire class when you open it in the editor. What you get is the class's name and a bunch of silly blocks which you must click one after another in order to see what they hide... Even after that the code is messed with the f...ing #region ... #endregion there and here. What's the point in collapsing a class into +fields, +constructors, +properties and +methods blocks?!

However, there's a worse thing to do - "regioning" pieces of a single method (yes, I've seen such a horrible things twice or three times in my career). Just imagine a double nested switch 2000 lines of code length. Done? Well. Now surround each of "case" with "region". I've seen it in reality :(

My opinion is simple: regions cause worse code in general - big classes with tons of big methods.

Comments

Popular posts from this blog

Computing cryptography hashes: Rust, F#, D and Scala

Upcoming F# struct tuples: are they always faster?

Composing custom error types in F#