Regions in C#

by Apr 11, 2023Shorts

Regions in C# is an anti-pattern or code smell.

When I review, I sometimes see a class that looks decent. Then I open the #region sections and it becomes a big giant monster.

If you think code should be in a #region because it’s a separate step or thing, it should be a method.

Please, don’t hide code with a #region.

Remy van Duijkeren

Remy van Duijkeren

The Marketing Developer

I build automation and integrations that remove the annoying stuff—using Power Platform, Dynamics 365 & Azure.

Get My Thoughts on Automation & Development

Join my personal newsletter and get practical insights on building faster, integrating smarter, and removing friction in IT systems — especially on Power Platform and Dynamics 365.

Related

.NET 10: ZIP it. Smarter.

.NET 10: ZIP it. Smarter. Yes, you could already update entries inside ZIP files before... But now you can do it without rewriting the entire...

read more