I had trouble writing a class that uses generics, because this is the first time I had to create a class that uses generics.
All I'm trying to do is create a method that converts a List to an EntityCollection.
I get a compiler error: Type "T" must be a reference type in order to use it as the "TEntity" parameter in the generic type or method "System.Data.Objects.DataClasses.EntityCollection"
Here is the code I'm trying to use:
public static EntityCollection<T> Convert(List<T> listToConvert) { EntityCollection<T> collection = new EntityCollection<T>();
He complains about the assembly EntityCollection = new line of EntityCollection () code.
If anyone can help me with this error or explain to me why I get it, I would really appreciate it. Thanks.
source share