Instantiating Internal class with private constructor

前端 未结 5 994
挽巷
挽巷 2020-11-30 08:25

I am trying to use reflection to create instance of a class. But it is sealed internal and has private constructor. I wonder how can i initiaise it and as its part of framew

5条回答
  •  臣服心动
    2020-11-30 09:16

    Use the Activator class to instantiate it

    Activator.CreateInstance(myType, true);
    

提交回复
热议问题