Using static method from generic class

后端 未结 4 754
陌清茗
陌清茗 2021-01-27 13:10

I have problem as above. My code:

public abstract class BaseFactory where T: class
{
    protected static dbModelContainer context = new dbModelContaine         


        
4条回答
  •  温柔的废话
    2021-01-27 13:29

    You can't, because there is no such method. The closest is to have a non-generic base that the generic class inherits from. Then you can have a method there that doesn't depend on the parameterising type.

提交回复
热议问题