How can I convert from a typed variable of an object containing an array of some type of enumeration to Enum []? In other words:
object enumArrayOfSomeType=...;
Enum[] someEnumArray=enumArrayOfSomeType as Enum[];
Unfortunately, the code presented always results in a null value in someEnumArray.
Is there any way to do this?
Update :
I suppose I expected the covariance of the array to start, but maybe I expected too much (i.e. the covariance of the arrays is wild).
In addition, thanks to Chris Sinclair for pointing out in the comments to the accepted answer that covariance of arrays is used only for references to types that are listed, of course, no. (See NET Array covariance rules on MSDN .)