How do I programatically set the value of a static boolean in a开发者_如何学Pythonnother app domain?
I'm testing an application where I need to change a bool value. Problem is that the bool value exists as a static instance on a type hosted in another app domain.
(I'm doing this for test purposes, it won't be used in production code)
The only way you can do that (apart from IO, Socket or Remoting communication) is by calling AppDomain.DoCallBack
to execute the code in another AppDomain.
For more information: http://msdn.microsoft.com/en-us/library/system.appdomain.docallback.aspx
But you cannot pass any data. So if you only need a Ping
from one AppDomain to set the boolean value, you can use this approach. Otherwise you can find some more information here: Sharing data between AppDomains
精彩评论