相关疑难解决方法(0)

C#通过枚举迭代?(索引System.Array)

我有以下代码:

// Obtain the string names of all the elements within myEnum 
String[] names = Enum.GetNames( typeof( myEnum ) );

// Obtain the values of all the elements within myEnum 
Array values = Enum.GetValues( typeof( myEnum ) );

// Print the names and values to file
for ( int i = 0; i < names.Length; i++ )
{
    print( names[i], values[i] ); 
}
Run Code Online (Sandbox Code Playgroud)

但是,我无法索引值.有更简单的方法吗?

或者我完全错过了什么!

c# iteration enums system.array

109
推荐指数
5
解决办法
12万
查看次数

如何枚举Objective-C中的枚举?

可能重复:
循环枚举值

假设我们正在处理一副牌

typedef enum {
    HEARTS, CLUBS, DIAMONDS, SPADES, SUIT_NOT_DEFINED
} Suit;
Run Code Online (Sandbox Code Playgroud)

我如何枚举枚举?

enums objective-c

6
推荐指数
1
解决办法
4417
查看次数

标签 统计

enums ×2

c# ×1

iteration ×1

objective-c ×1

system.array ×1