是否可以从另一个单独的 .NET AppDomian 更改 .NET AppDomain 中的字符串属性的值
假设两个 AppDomain 在同一进程中运行,是否可以从另一个单独的 .NET AppDomain 更改给定 .NET AppDomain 中类的公共属性(类型字符串)的值。另一个重要的假设是,在包含该属性的 AppDomain 中运行的代码不能被修改.. 即.. 进行任何更改后重新编译。
谢谢!
Is it possible to change the value of a public property (type string) of a class within a given .NET AppDomain from another separate .NET AppDomain assuming both AppDomain's are running in the same process. The other important assumption is that the code running in the AppDomain that contains the property can not be modified .. ie .. recompiled with any changes.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当然。您只需通过 MarshalByRef 对象公开对该属性的访问,该对象将允许 AppDomain A 中的一个实例接触并触摸 AppDomain B 中的属性。
以下是将从 AppDomain A 在 AppDomain B 中实例化的类的一个简单示例:
以下是如何从 AppDomain A 使用它:
Sure. You just need to expose access to the property via a MarshalByRef object that will allow one instance in AppDomain A to reach out and touch the property in AppDomain B.
Here is a simple example of the class that would be instantiated in AppDomain B from AppDOmain A:
And here is how you would consume it from AppDomain A: