I have the following class
public class AccountingBase<TItemType> where TItemType : AccountingItemBase
And in my AccountItemBase, I have the following property:
public virtual AccountingBase<AccountingItemBase> Parent { get; set; }
in my AccountBase, I am trying to do the following
item.Parent = this;
Logically, this should work, since TItemType inherits from AccountingItemBase, but instead I get the following error:
> Error 1 Cannot implicitly convert type
> 'TGS.MySQL.DataBaseObjects.AccountingBase<TItemType>'
> to
> 'TGS.MySQL.DataBaseObjects.AccountingBase<TGS.MySQL.DataBaseObjects.AccountingItemBase>'
How to set parent property of child properties to itself (inside parent class)
source
share