In some existing piece of code i see the following:
public abstract class BasicComponent<T> : IBasicComponent<T>
where T : class, new()
I know what an abstract class is, and an interface. But what is it doing with where T and what happends when you extends class and new()?
These are generic type constraints.
The
classmeans that theTyou use must be a class (including interface, delegate and arrays), thenewthat it must have a public parameterless constructor.From the linked MSDN document: