<p>Is it possible to define a class in C# such that</p>

<pre><code>class GenericCollection&lt;T&gt; : SomeBaseCollection&lt;T&gt; where T : Delegate
</code></pre>

<p>I couldn't for the life of me accomplish this last night in .NET 3.5. I tried using</p>

<p><code>delegate, Delegate, Action&lt;T&gt; and Func&lt;T, T&gt;</code></p>

<p>It seems to me that this should be allowable in some way. I'm trying to implement my own EventQueue.</p>

<p>I ended up just doing this [primitive approximation mind you].</p>

<pre><code>internal delegate void DWork();

class EventQueue {
    private Queue&lt;DWork&gt; eventq;
}
</code></pre>

<p>But then I lose the ability to reuse the same definition for different types of functions.</p>

<p>Thoughts?</p>

A number of classes are unavailable as generic contraints - Enum being another.
For delegates, the closest you can get is ": class", perhaps using reflection to check (for example, in the static constructor) that the T
is
a delegate:
```
```
static GenericCollection()
{
    if (!typeof(T).IsSubclassOf(typeof(Delegate)))
    {
        throw new InvalidOperationException(typeof(T).Name + " is not a delegate type");
    }
}
```
```