Your problem occurs because of Covariance and Contravariance, imagine that worked as you want it to, you could then do this :
public void DisplayItems(EntityCollection<Object> items)
{
//Probably not called add but you get the idea...
items.Add(new AnyObjectILike());
items.Add(new System.Windows.Form());
}
EntityCollection<Student> students;
DisplayItems((EntityCollection<Object>) students); //type casting here
Clearly adding instances that are not of type Student
to the EntityCollection<Student>
causes a massive problem which is one of the reasons this is not allowed, you can alter this behaviour for interfaces using the In
and Out
keywords.