Created
November 9, 2018 20:35
-
-
Save noakesey/0d89d1b5d4663cc77aa113e5532d4a80 to your computer and use it in GitHub Desktop.
How to iterate through an enum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DictEnum dictEnum = new DictEnum(enumNum(ProjFundingType)); | |
if (dictEnum) | |
{ | |
int enumValueCount = dictEnum.values(); | |
//Iterate on positions, not values!! | |
for (int enumValueIndex = 0; enumValueIndex < enumValueCount; enumValueIndex++) | |
{ | |
if (dictEnum.index2Value(enumValueIndex) != ProjFundingType::Customer) | |
{ | |
doSomething(dictEnum.index2Value(enumValueIndex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment