有没有办法使用 C++/CLI 管理的枚举作为数组下标?
我有一个枚举声明为
enum class AccessLevel : int
{
ReadOnly = 0,
Excluded = 1,
ReadWrite = 2,
};
和一个数组声明为
static array<String^>^ _accessMap = gcnew array<String^> { "R", "X", "W" };
我想做这样的事情:
AccessLevel^ access = access::ReadOnly;
String^ foo = _accessMap[access];
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];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可能需要转换为 int
you might need to cast to an int