tags:

views:

376

answers:

1

i have an enum declared as

enum class AccessLevel : int
{
 ReadOnly = 0,
 Excluded = 1,
 ReadWrite = 2,
};

and an Array declared as

static array<String^>^ _accessMap = gcnew array<String^> { "R", "X", "W" };

I want to do something like this:

AccessLevel^ access = access::ReadOnly;
String^ foo = _accessMap[access];
+1  A: 
public enum struct AccessLevel
{
        ReadOnly = 0,
        Excluded = 1,
        ReadWrite = 2,
};

AccessLevel access = access::ReadOnly;

you might need to cast to an int

String^ foo = _accessMap[(int)access];
Aaron Fischer