How to declare a generic constraint that is a generic type
- by HackedByChinese
I have a two generic abstract types: Entity and Association.
Let's say Entity looks like this:
public class Entity<TId>
{
//...
}
and Association looks like this:
public class Association<TEntity, TEntity2>
{
//...
}
How do I constrain Association so they can be of any Entity?
I can accomplish it by the following:
public…