Barry R. and Rob P.'s coworker had a problem: how could he really, really make sure they verify that a value stored in an enumeration, say the EmailsFormat enum, is actually a valid value for that enumeration? With the handy FromEmailsFormat function of course!

public enum EmailsFormat


public static EmailFormat FromEmailsFormat( EmailsFormat emailsFormat )
    switch ( emailsFormat )
        case EmailsFormat.HTML:
            return EmailFormat.HTML;
        case EmailsFormat.Text:
            return EmailFormat.Text;
            throw new Exception( "Unknown EmailsFormat enum value!" );
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!