What is the purpose of new() while declaration of BaseEntityCollection class?
If I’m going to remove it, I got an error with the following message “T must be a non-abstract type with a public parameterless constructor in order to use it as parameter …”
public abstract partial class BaseEntityCollection<T> :
List<T> where T : BaseEntity, new()
It means that whatever class you specify for
T, it has a default (no parameters) constructor.Therefore, in the generic class, you can do
new T()and it will create a new object of type T.