Type EnumExtensions
Namespace ImageResizer.ExtensionMethods
Extends enumerations by allowing them to define alternate strings with the [EnumString("Alternate Name",true)] attribute, and support it through TryParse and ToPreferredString
Methods
Public static methods
Nullable<T> Parse<T>(string value)
Nullable<T> Parse<T>(T en, string value)
Attempts case-insensitive parsing of the specified enum. Returns null if parsing failed.
Supports [EnumString("Alternate Value")] attributes and parses flags. If any segment of a comma-delimited list isn't parsed as either a number or string, null will be returned.
T Parse<T>(T en, string value, T defaultValue)
Attempts case-insensitive parsing of the specified enum. Returns the specified default value if parsing fails.
Supports [EnumString("Alternate Value")] attributes and parses flags. If any segment of a comma-delimited list isn't parsed as either a number or string, defaultValue will be returned.
string ToPreferredString(Enum en, bool lowerCase)
Retuns the string representation for the given enumeration