If you want an array of the Enum type, you have to loop. If you want an
array of strings, you can use GetValues or GetNames, depending on what you
are aiming at.
I can't think of any other way off hand.
--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA
Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#
or just read it:
http://feeds.feedburner.com/GregoryBeamer
********************************************
| Think outside the box! |
********************************************
"Rene" <(E-Mail Removed)> wrote in message
news:uTW$(E-Mail Removed)...
> If variance/covariance is not allowed in array of value types, why is the
> expression on the "Main" method run successfully (see snippet below)? I am
> missing something?
>
> Thank you.
>
> ---------------------
> class Program
> {
> enum Foo
> {
> a, b, c
> }
>
> enum Bar
> {
> x, y, z
> }
>
> static void Main(string[] args)
> {
> Bar[] barArray = (Bar[])System.Enum.GetValues(typeof(Foo));
> }
> }
> ---------------------
>