Given a generic parameter TEnum which always will be an enum type, is there any way to cast from TEnum to int without boxing/unboxing?
See this example code. This w
I hope that I'm not too late...
I think that you should consider to solve your problem with a different approach instead of using Enums try to creating a class with a public static readonly properties.
if you will use that approach you will have an object that "feels" like an Enum but you will have all the flexibility of a class which means that you can override any of the operators.
there are other advantages like making that class a partial which will enable you to define the same enum in more then one file/dll which makes it possible to add values to a common dll without recompiling it.
I couldn't find any good reason not to take that approach (this class will be located in the heap and not on the stack which is slower but it's worth it)
please let me know what you think.