LLBLGen Pro version + buildnr = Version 2.0.0.0 Final (November 6th, 2006)
Template = Adapter
.NET version = 2.0
This is probably really just a C# question about generics and interfaces, but I thought I'd ask here anyways.
The EntityCollection class that is generated looks like this:
public partial class EntityCollection<TEntity> : EntityCollectionBase2<TEntity>
where TEntity : EntityBase2, IEntity2
So it looks like the generic EntityCollection is constrained to types that inherit from EntityBase2 and implement interface IEntity2.
So I can make variable declarations like this:
EntityCollection<IEntity2> collection;
EntityCollection<EntityBase2> collection2;
So how come I can't declare method parameters that way.
In the code below, Method1 won't compile, but Method2 will.
public void Method1( EntityCollection<IEntity2> collection)
{
// do something
}
public void Method2( EntityCollection<EntityBase2> collection)
{
// do something
}
The compilation error message for Method1 is:
The type 'SD.LLBLGen.Pro.ORMSupportClasses.IEntity2' must be convertible to 'SD.LLBLGen.Pro.ORMSupportClasses.EntityBase2' in order to use it as parameter 'TEntity' in the generic type or method 'GCS.Data.HelperClasses.EntityCollection<TEntity>'