Bashar wrote:
When I do that, like so:
toReturn.NonGenericEntityCollection = DirectCast(GenericEntityCollection, IEntityCollection2)
I get:
Option Strict On disallows implicit conversions from 'SD.LLBLGen.Pro.ORMSupportClasses.IEntityCollection2' to 'ATC.ITAuto.DAL.HelperClasses.EntityCollection'.
What to do?
To use a generic collection, you can cast it to an IEntityCollection2 type. I'm not sure what toReturn is here though and what NonGenericEntityCollection is.
Every entity collection, generic or non generic, implements IEntityCollection2. This means that you can use a variable of type IEntityCollection2 and set it to any generic/nongeneric collection you run into.
However, the nongeneric EntityCollection type in the helperclasses is really EntityCollection<EntityBase>, and it can't be cast from EntityCollection<SomeEntity>, as that would mean covariance which isn't supported by C# and VB.NET