J
Jay
I want to be able to pass different enums into a method which makes use of the enum in some way.
I've put together a simplified example below. How do I correctly pass an enum (eg Test1 or Test2 as
shown in CallingMethod) to the UseEnum method?
enum Test1 {Err, Start, Block, Hold}
enum Test2 {Err, Book, Plug}
void UseEnum(Enum myEnum){
string[] enumStr = Enum.GetNames(typeof(myEnum));
}
void CallingMethod(){
UseEnum(Test1);
UseEnum(Test2);
}
I've put together a simplified example below. How do I correctly pass an enum (eg Test1 or Test2 as
shown in CallingMethod) to the UseEnum method?
enum Test1 {Err, Start, Block, Hold}
enum Test2 {Err, Book, Plug}
void UseEnum(Enum myEnum){
string[] enumStr = Enum.GetNames(typeof(myEnum));
}
void CallingMethod(){
UseEnum(Test1);
UseEnum(Test2);
}