Link Details

Link 1049191 thumbnail
User 225256 avatar

By mswatcher
via codeproject.com
Submitted: Oct 14 2013 / 13:06

It was simply that I wanted to protect against erroneus input to a method that took an enum as a parameter, only I wasn't sure how to go about it. So I stumbled into Enum.IsDefined and then spent quite some time trying to work out how it behaved under different circumstances, i.e. what response was given to different inputs. On reflection neither using an enum in the particular scenario I had nor using IsDefined are that smart, using the Strategy Pattern[^] instead would probably be a better idea.
  • 3
  • 0
  • 80
  • 24

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (3)



Voters Against This Link (0)



    Apache Hadoop
    Written by: Piotr Krewski
    Featured Refcardz: Top Refcardz:
    1. Play
    2. Akka
    3. Design Patterns
    4. OO JS
    5. Cont. Delivery
    1. Play
    2. Java Performance
    3. Akka
    4. REST
    5. Java