title: C# Generics Inheritance
body: <p>I have the following class</p>
  
  <pre><code>public class AccountingBase&lt;TItemType&gt; where TItemType : AccountingItemBase
  </code></pre>
  
  <p>And in my AccountingItemBase i have the following property:</p>
  
  <pre><code>public virtual AccountingBase&lt;AccountingItemBase&gt; Parent { get; set; }
  </code></pre>
  
  <p>in my AccountingBase, I am trying to do the following</p>
  
  <pre><code>item.Parent = this;
  </code></pre>
  
  <p>Logically this should work, as TItemType inherits from AccountingItemBase, but instead i get the following error:</p>
  
  <pre><code>&gt; Error 1 Cannot implicitly convert type
  &gt; 'TGS.MySQL.DataBaseObjects.AccountingBase&lt;TItemType&gt;'
  &gt; to
  &gt; 'TGS.MySQL.DataBaseObjects.AccountingBase&lt;TGS.MySQL.DataBaseObjects.AccountingItemBase&gt;'
  </code></pre>
  
  <p>How can i set the child properties parent property to itself (inside the parent class)</p>