To my surprise, I get the following statement:
public static IEnumerable AllEnums
=> Enum.GetValues(typeof(SomeType));
to
I thought that the latter was inheriting from the former.
Enum.GetValues returns Array, which implements the non-generic IEnumerable, so you need to add a cast:
public static IEnumerable AllEnums = Enum.GetValues(typeof(SomeType))
.Cast()
.ToList();
This works with LINQ because Cast extension method is defined for the non-generic IEnumerable interface, not only on IEnumerable.
Edit: A call of ToList() avoid inefficiency associated with walking multiple times an IEnumerable produced by LINQ methods with deferred execution. Thanks, Marc, for a great comment!