开发者

How can I share the data of a dictionary between two appdomains in the same process

开发者 https://www.devze.com 2023-04-01 10:23 出处:网络
I have a program in which I am creating two appdomains A and B . I want to share a dictionary between them. Basically I am creating the dictionary in appdomain A. At this stage, for each key in the di

I have a program in which I am creating two appdomains A and B . I want to share a dictionary between them. Basically I am creating the dictionary in appdomain A. At this stage, for each key in the dictionary the value part is initialized to null. Then appdomain B needs to access this dictionary and fill in the values for the corresponding keys. After this, A will use the updated dictionary. Could someone please tell me how can I go about do开发者_JAVA技巧ing this. It would be great to have a very small sample example outlining the procedure. Thanks in advance


You cannot share an object between two appdomains. Have a look at .net Remoting or WCF if you need to share data between two or more appdomains.


I don't know much about sharing across AppDomains but have you tried AppDomain.SetData() and AppDomain.GetData()? If that doesn't work, everyone else pretty much says use WCF or if your project is older then Remoting.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号