
Recursive type constraint error
By:
mylesmcdonnell on
Jan 6th, 2012 | syntax:
C# | size: 0.26 KB | hits: 15 | expires: Never
public class Entity<T> { }
public class MyEntity : Entity<object> { }
public class Service<T> where T : Entity<T> { }
public class Test
{
private Service<MyEntity> _service; //Not possible because MyEntity has to be convertible to Entity<MyEntity>
}