如何共享两个C#项目之间的变量

编程入门 行业动态 更新时间:2024-10-23 22:29:27
本文介绍了如何共享两个C#项目之间的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想用两个不同的项目之间的共享变量,我想在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#项目之间的变量

本文发布于:2023-11-25 22:38:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1631632.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:变量   两个   项目

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!