Advertisement
mylesmcdonnell

Recursive type constraint error

Jan 6th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.26 KB | None | 0 0
  1. public class Entity<T> { }
  2.  
  3. public class MyEntity : Entity<object> { }
  4.  
  5. public class Service<T> where T : Entity<T> { }
  6.  
  7. public class Test
  8. {
  9.    private Service<MyEntity> _service; //Not possible because MyEntity has to be convertible to Entity<MyEntity>
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement