Better Alternative to Case Statement

Posted by Kyle Rozendo on Stack Overflow See other posts from Stack Overflow or by Kyle Rozendo
Published on 2010-05-21T07:09:00Z Indexed on 2010/05/21 7:20 UTC
Read the original article Hit count: 435

Filed under:
|
|

Hi All,

I currently have a switch statement that runs around 300 odd lines. I know this is not as giant as it can get, but I'm sure there's a better way to handle this.

The switch statement takes an Enum that is used to determine certain properties that pertain to logging. Right now the problem sets in that it is very easy to leave out an enumeration value and that it will not be given a value as it is not in the switch statement.

Is there an option one can use to ensure that every enumeration is used and given a custom set of values it needs to do its job?

Thanks,

Kyle

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET