Skip to content

Instantly share code, notes, and snippets.

@noakesey
Created November 9, 2018 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noakesey/0d89d1b5d4663cc77aa113e5532d4a80 to your computer and use it in GitHub Desktop.
Save noakesey/0d89d1b5d4663cc77aa113e5532d4a80 to your computer and use it in GitHub Desktop.
How to iterate through an enum
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