Specifying that a constrained generic class is a subclass?
<p>I have this class definition:</p>

<pre><code>public abstract class AbstractListViewModel&lt;T&gt;  : AbstractWorkspaceViewModel
</code></pre>

<p>So I have a class called <code>AbstractListViewModel</code> that has a generic type, and that is a subclass of <code>AbstractWorkspaceViewModel</code>.</p>

<p>However, I need to constrain <code>T</code> to only be subclasses of <code>AbstractWorkspaceViewModel</code>. I tried the following:</p>

<pre><code>public abstract class AbstractListViewModel&lt;T&gt; where T :
    AbstractWorkspaceViewModel, : AbstractWorkspaceViewModel
public abstract class AbstractListViewModel&lt;T&gt; where T :
    AbstractWorkspaceViewModel : AbstractWorkspaceViewModel
</code></pre>

<p>But this syntax is invalid.</p>

<p>So here I am trying to say "A class called <code>AbstractListViewModel</code> that is a subclass of <code>AbstractWorkspaceViewModel</code> and has a generic type that is also a subclass of <code>AbstractWorkspaceViewModel</code>.</p>

<p>How do I define this?</p>
