After failing to get something like the following to compile:
public class Gen where T : System.Array
{
}
with the error
I found a Jon Skeet comment from 2008 on a similar question:
Why is the System.Enum
constraint not supported.
I know this is a bit off topic, but he asked Eric Lippert (the C# team) about it and they provided this answer:
First off, your conjecture is correct; the restrictions on constraints are by and large artefacts of the language, not so much the CLR. (Were we to do these features there would be a few minor things we'd like to change in the CLR regarding how enumerable types are specified, but mostly this would be language work.)
Second, I would personally love to have delegate constraints, enum constraints, and the ability to specify constraints that are illegal today because the compiler is trying to save you from yourself. (That is, making sealed types legal as constraints, and so on.)
However, due to scheduling restrictions, we will likely not be able to get these features into the next version of the language.