Is it possible to do the following with an enum in C#?:
-
Pass in to a method a selected value of the enum (eg if an enum has members such as Red, Green, Orange, I can pass in Colors.Red).
-
In the method body of the above method which accepts an enum, I can say if (Enum == Colors.Red).
What would be the syntax for this? I’ve always seemed to have stalled on this.
Yes, just like you would with any other type …