public class Animal{ public string Name;}public class Dog : Animal{ public Color Color;}public class Cat : Animal{ public float Weight;}public class Food<TAnimal> where TAnimal : Animal{ public void Feed() { }}public class Testing{ public Testing() { // works var animals = new List<Animal>() { new Dog(), new Cat(), }; // fail var animalFood = new List<Food<Animal>>() { new Food<Dog>(), new Food<Cat>() }; }}