Static members behavior with multiple instance of application - C#

对着背影说爱祢 提交于 2019-12-01 05:55:25
Tigran

The variable static or not is a part of your application memory. When you open 2 instances of your application you create two distinct memory locations in the OS, so there is not any relation between those 2 variables at all.

If you want to create one (relation), you have to look on different IPC (Inter Process Communication) methods available in OS, like:

No, Each application instance are isolated from one another using AppDomain. Thus each application instance will run in a seperate AppDomain and cannot access the variables from other domain. To do communicate with different domain we need to use Remoting , WCF Service

Every instance.

Static members are allocated on a per AppDomain basis. If you were to spawn a new AppDomain from within your current one.. they would be different.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!