What is the scope of a Static Class?

后端 未结 5 664
小蘑菇
小蘑菇 2020-12-14 18:56

I have an assembly that may be used by more than one process at a time. If I am using a static class, would the multiple processes all use the same \"instance\" of that cla

5条回答
  •  不思量自难忘°
    2020-12-14 19:43

    You may want to look at the Singleton pattern. The gist seems to be you want to control the number of service instances.

    I'm guessing that you want a separate dll/project servicing all the client requests. You could use static class/singleton/multiton to implement the desired functionality. It really depends on what you are trying to accomplish.

提交回复
热议问题