Can a Singleton Class inside a DLL be shared across processes?

前端 未结 5 2093
眼角桃花
眼角桃花 2020-12-06 01:27

I am creating a custom .net hardware framework that will be used by other programmers to control some hardware. They will add a reference to our DLL to get to our hardware f

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 02:13

    To add to the Kevin's answer, your constructor for your class Resources should really be made private for it to be a true singleton, otherwise nothing is stopping someone from creating a new instance of the Resources class through the constructor. This doesn't solve your problem, but it does stop one from misusing the Singleton.

提交回复
热议问题