Is there a way to create a method that gets an enum type as a parameter, and returns a generic list of the enum underlying type from it’s values, no matter if the underlying type is int\short byte etc’…
I saw this answer of Jon Skeet, but it looks way too complicated.
Is there a way to create a method that gets an enum type as
Share
If you want to pass in a
Type, it can’t really be usefully generic – you’d have to return a single type that isn’t directly related to the input, hence something like:This is a strongly-typed vector underneath, so you could cast that to
int[]etc.