What is the syntax for a default constructor for a generic class?

后端 未结 3 1497
北荒
北荒 2020-12-13 01:36

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 it c

3条回答
  •  渐次进展
    2020-12-13 01:47

    You don't provide the type parameter in the constructor. This is how you should do it.

    public class Cell 
    {
        public Cell()
        {
        }
    }
    

提交回复
热议问题