Right. About the best you can do is make the method take the underlying type
such as Int32, eg:

Void PassEnumToMethod(int[] enums)

|-----Original Message-----
|From: [email protected] [mailto:ozdotnet-
|[email protected]] On Behalf Of Greg Keogh
|Sent: Sunday, 6 November 2011 10:34 AM
|To: 'ozDotNet'
|Subject: Passing arrays of Enum
|
|Folks, I thought this would be valid:
|
|
|
|public enum MyEnum { Foo, Bar, Whizz, Bang };
|
|:
|
|PassEnumToMethod(MyEnum[] enums)
|
|:
|
|Void PassEnumToMethod(Enum[] enums)
|
|{
|
|    // Generic code for any type of Enum here
|
|}
|
|
|
|The C# compiler says it can't convert from MyEnum to System.Enum. It may be
|early on Sunday morning, but what am I forgetting?
|
|
|
|Cheers,
|
|Greg


Reply via email to