Is it forbidden in C# to implement a default constructor for a generic class?
If not, why the code below does not compile? (When I remove <T>
it compiles though)
What is the correct way of defining a default constructor for a generic class then?
public class Cell<T>
{
public Cell<T>()
{
}
}
Compile Time Error: Error 1 Invalid token '(' in class, struct, or interface member declaration
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…