getting Key:Value pairs of an enum at compile time ?

Jacob Carlborg doob at me.com
Thu Jan 23 07:21:46 PST 2014


On 2014-01-23 16:07, Uplink_Coder wrote:
> Hello,
>
> I have an Enum to represent possible Options for a selectList
> e.g
> enum options {
>    blueish="Blue",
>    redish ="Red"
> }
> and I want the List-Entrys to say
> "blueish" or "redish".
> the value send to the app should be
> "Blue" or "Red".
> I can use __traits(allMembers,Enum)
> for the identifiers, but how do I get the Values ?

Try getMember: http://dlang.org/traits.html#getMember

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list