In C#, is it possible to cast a List<Child> to List<Parent>?

Viewed 43064

I want to do something like this:

List<Child> childList = new List<Child>();
...
List<Parent> parentList = childList;

However, because parentList is a List of Child's ancestor, rather than a direct ancestor, I am unable to do this. Is there a workaround (other than adding each element individually)?

5 Answers
Related