【发布时间】:2010-03-05 04:42:32
【问题描述】:
我有两个不同的应用程序,我正在使用 GroupLab Networking 在它们之间进行通信。这个想法是有一个共享字典,当这个共享字典发生变化时,另一个应用程序会收到通知。通知部分有效。这是问题所在。我在第一个应用程序中有以下代码。
TouchInfo t = new TouchInfo();
int.TryParse(txtXCoord.Text, out t.X);
int.TryParse(txtYCoord.Text, out t.Y);
this.sharedDictionary1["/pointOne"] = t;
其中TouchInfo 是struct。两个应用程序都可以访问存储在共享字典中的这个对象。代码如下所示:
TouchInfo val = (TouchInfo)this.sharedDictionary1["/pointOne"]
虽然此代码在创建对象的应用程序中有效。我在第二个收到以下错误:
{Unserializable object: problem: System.Runtime.Serialization.SerializationException: Unable to find assembly 'NetworkingTestProgramOne, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
我意识到这个问题是因为序列化还存储了序列化它的程序的汇编信息。但我确实需要它来跨不同的程序进行通信。我该如何完成这项工作?
【问题讨论】:
标签: c# serialization communication