What does 'new' keyword mean when used inside an interface in C#?

前端 未结 7 853
醉梦人生
醉梦人生 2020-12-08 10:14

Developing an interface generic I wished to declare a constructor in an interface but it says constructors are forbidden there. I\'ve tried to declare a static factory metho

相关标签:
7条回答
  • 2020-12-08 10:56

    You're using an interface, but it sounds like you want a base class instead. An interface should never need a constructor, as it can't contain any fields that would need to be initialized in the constructor. I think you want to use a base class instead.

    0 讨论(0)
提交回复
热议问题