Regional Accents

Jay Fields wonders when it is appropriate to use #region blocks in C#. I've found a good use them! Here's a test from nMock 2, a port of jMock to C# that I've been writing on and off over the last few weeks.


What's the value of ANY_NUMBER? You shouldn't care! It means any number. So I hid the declaration in a region. If the reader opens that region:


What, you really want to know? Ok, but don't say I didn't warn you.


Did I say it was a good use of regions? Perhaps that was not completely accurate.

Copyright © 2005 Nat Pryce. Posted 2005-05-16. Share it.