This will return an IEnumerable<SomeEnum> of all the values of an Enum.

Enum.GetValues(typeof(SomeEnum)).Cast<SomeEnum>();

If you want that to be a List<SomeEnum>, just add .ToList() after .Cast<SomeEnum>().

To use the Cast function on an Array you need to have the System.Linq in your using section.

相关文章:

  • 2021-06-18
  • 2021-06-24
  • 2022-03-02
  • 2021-08-09
  • 2022-12-23
  • 2022-03-04
  • 2022-01-26
  • 2022-01-15
猜你喜欢
  • 2021-09-14
  • 2022-01-15
  • 2021-06-05
  • 2022-12-23
  • 2022-01-23
  • 2022-03-07
相关资源
相似解决方案