EnumUtil.cs 451 B

1234567891011121314151617181920
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Aitex.Core.Utilities
  6. {
  7. public class EnumLoop<Key> where Key : struct, IConvertible
  8. {
  9. static readonly Key[] arr = (Key[])Enum.GetValues(typeof(Key));
  10. public static void ForEach(Action<Key> act)
  11. {
  12. for (int i = 0; i < arr.Length; i++)
  13. {
  14. act(arr[i]);
  15. }
  16. }
  17. }
  18. }