Consider the following code:
class Base<T> { //Base members }
I want generic T to be an enumeration (using restrictions if possible). How to do it in C #?
EDIT:
Using the code contracts introduced by Akash Kava also seems nice. I managed to get him to create a runtime error that is useless. Here is the code I tried. It should be possible to create a compilation warning, but I can't get it to work.
generics c # type-constraints
atoMerz
source share