c# - Would you use regions within long switch/enum declarations? -


I recently needed myself to define the stupid long switch statement ( Yes, is needed) enum announcements in the C # code, but I am thinking that what people think is the best way to divide them into logical sub-sections, in my situation, both enum Prices and cases (which are based on enum values) are quite clear groups, yet I have a few Or am unsure how to reflect in this code.

Note that in my code, I have around 5 groups between 10 and 30 enum values ​​/ cases.

I understand that there are three obscure sense choices:

  1. defined #region within the declarations of logical groups / alternate values ​​of all cases Beach block (alternatively divided by empty rows).
  2. Write each group name with each blank name before the empty name before group name.
  3. Do nothing - just leave the switch / NAM as a large list of cases / values.

Whom do you like? Will you use emos and switch separately? (This seems a bit awkward for me.) Now, I will not say that there is a right / wrong answer to this question, although I can still be very interested in listening.

< Strong> Note 1: In this situation where potentially a very long nm announcement of 50/100 + values ​​can be unfortunately (and similarly switch), because I write a laser (tokenizer) I am trying, and in this way, for many reasons It looks the most appropriate approach.

Note 2: I am fully aware that many duplicate questions are already present on the question of using areas (mainly for structures) in normal code, but I think my question is more specific here and has not been addressed yet.

Of course, those things do not change a lot of things above, and when they do, You can expand the area, make your changes, make it fall, and move on to other files

They are for a reason, use them for your benefit .


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -