Created
June 23, 2022 04:40
-
-
Save rpbeukes/da3366089df03be3d1d2f269ab82519e to your computer and use it in GitHub Desktop.
Foreach over an Enum value
This file contains hidden or 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
public class Enum<EnumT> where EnumT : Enum | |
{ | |
public static void ForEach(Action<EnumT> action) | |
{ | |
foreach (EnumT status in Enum.GetValues(typeof(EnumT))) | |
action(status); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useage