我想用两个不同的项目之间的共享变量,我想在C#每次更新变量? 我用dll文件共享varible但在更新变量并没有奏效。 。请帮助
I want to use shared variable between two different projects and i want to update that variable each time in c#? I used dll file to share a varible but it didn't worked while updating the variable. please help.
public static class Signals { public static bool Admin_Logged_In; public static bool get_Admin_Flag() { return Admin_Logged_In; } public static bool get_Busy_Flag() { return Back_End_Busy; } }
我连着上面的DLL文件类,并在两个所指向不同的项目和放大器;然后尝试在一个项目和放大器来更新值;期望得到的第二个项目更新后的值。但它不提供更新后的值。
i attached above class in DLL file and refered in two different projects & then try to update value in one project & expecting to get updated value in second project. but it doesn't provide updated value.
推荐答案有关的DLL MS文档状态:在默认情况下,使用DLL的每个进程都有自己的所有DLL全局实例和静态变量。
The MS documentation states about DLLs : "By default, each process using a DLL has its own instance of all the DLLs global and static variables.".
就以这一点,提供一些解决方法请看:的 msdn.microsoft/en-us/library/h90dkhs0(v = VS.80)的.aspx
Take a look on this that give some workaround : msdn.microsoft/en-us/library/h90dkhs0(v=vs.80).aspx
顺便说一句,我会使用网络通讯分享这个值。
BTw, I would share this values using network communications.
更多推荐
如何共享两个C#项目之间的变量
发布评论