You can't, because C# and VB.NET don't support covariance. (the term for this behavior is covariance). The CLR does, but C# and VB.NET dont.
If you have a List<string> foo and you want to cast it to List<object> like:
List<object> bar = (List<object)foo;
it won't work, because even though the generic parameter types are in a hierarchy, the collection's aren't.
This will work:
EntityCollection<CustomerEntity> foo = ... ;
EntityCollectionBase2<CustomerEntity> bar = (EntityCollectionBase2<CustomerEntity>)foo;
because EntityCollectionBase2<CustomerEntity> is the supertype of EntityCollection<CustomerEntity>.
However casting it to EntityCollectionBase2<EntityBase2> doesn't work, as that would mean that the EntityCollectionBase2<EntityBase2> is then a 'portal' to add other EntityBase2 objects to the original EntityCollection<CustomerEntity> collection, of a different type than CustomerEntity.
If you want a generic way to access these collections, use IEntityCollection2.