C# Class DrutNET.StringEnum

Helper class for working with 'extended' enums using StringValueAttribute attributes.
Mostra file Open project: bricel/DrutNet Class Usage Examples

Public Methods

Method Description
DisplayVal ( Enum value ) : string
GetDisplayValues ( ) : Array
GetListValues ( ) : IList

Gets the values as a 'bindable' list datasource.

GetStringValue ( string valueName ) : string

Gets the string value associated with the given enum value.

GetStringValues ( ) : Array

Gets the string values associated with the enum.

IsStringDefined ( Type enumType, string stringValue ) : bool

Return the existence of the given string value within the enum.

IsStringDefined ( Type enumType, string stringValue, bool ignoreCase ) : bool

Return the existence of the given string value within the enum.

IsStringDefined ( string stringValue ) : bool

Return the existence of the given string value within the enum.

IsStringDefined ( string stringValue, bool ignoreCase ) : bool

Return the existence of the given string value within the enum.

Parse ( Type type, string stringValue ) : object

Parses the supplied enum and string value to find an associated enum value (case sensitive).

Parse ( Type type, string stringValue, bool ignoreCase ) : object

Parses the supplied enum and string value to find an associated enum value.

StrVal ( Enum value ) : string

Gets a string value for a particular enum value.

StringEnum ( Type enumType ) : System

Creates a new StringEnum instance.

Method Details

DisplayVal() public static method

public static DisplayVal ( Enum value ) : string
value System.Enum
return string

GetDisplayValues() public method

public GetDisplayValues ( ) : Array
return System.Array

GetListValues() public method

Gets the values as a 'bindable' list datasource.
public GetListValues ( ) : IList
return IList

GetStringValue() public method

Gets the string value associated with the given enum value.
public GetStringValue ( string valueName ) : string
valueName string Name of the enum value.
return string

GetStringValues() public method

Gets the string values associated with the enum.
public GetStringValues ( ) : Array
return System.Array

IsStringDefined() public static method

Return the existence of the given string value within the enum.
public static IsStringDefined ( Type enumType, string stringValue ) : bool
enumType System.Type Type of enum
stringValue string String value.
return bool

IsStringDefined() public static method

Return the existence of the given string value within the enum.
public static IsStringDefined ( Type enumType, string stringValue, bool ignoreCase ) : bool
enumType System.Type Type of enum
stringValue string String value.
ignoreCase bool Denotes whether to conduct a case-insensitive match on the supplied string value
return bool

IsStringDefined() public method

Return the existence of the given string value within the enum.
public IsStringDefined ( string stringValue ) : bool
stringValue string String value.
return bool

IsStringDefined() public method

Return the existence of the given string value within the enum.
public IsStringDefined ( string stringValue, bool ignoreCase ) : bool
stringValue string String value.
ignoreCase bool Denotes whether to conduct a case-insensitive match on the supplied string value
return bool

Parse() public static method

Parses the supplied enum and string value to find an associated enum value (case sensitive).
public static Parse ( Type type, string stringValue ) : object
type System.Type Type.
stringValue string String value.
return object

Parse() public static method

Parses the supplied enum and string value to find an associated enum value.
public static Parse ( Type type, string stringValue, bool ignoreCase ) : object
type System.Type Type.
stringValue string String value.
ignoreCase bool Denotes whether to conduct a case-insensitive match on the supplied string value
return object

StrVal() public static method

Gets a string value for a particular enum value.
public static StrVal ( Enum value ) : string
value System.Enum Value.
return string

StringEnum() public method

Creates a new StringEnum instance.
public StringEnum ( Type enumType ) : System
enumType System.Type Enum type.
return System