I am trying to write a decent client/server application. I am stuck on sending my objects back and forth. I have been reading all day and cant seem to find the answer i need.
I have come up with the following class, when I serialize the data its fine, i send it to the client fine, when I try to deserialize it on the client side it throws an error, cand find the server assembly.Why would it be looking for the server assembly? Any help/recomendations would be more than welcomed.
[Serializable()]
public class ChatterList : ArrayList
{
public Chatter Find(string id)
{
foreach (Chatter c in this)
{
if (c.ID == id)
return c;
}
return null;
}
public static byte[] SerializeList(ChatterList clist)
{
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, clist);
return ms.ToArray();
}
public static object DeSerializeList(byte[] data)
{
MemoryStream ms = new MemoryStream(data);
BinaryFormatter bf = new BinaryFormatter();
return (ChatterList)bf.Deserialize(ms);
}
}
I have come up with the following class, when I serialize the data its fine, i send it to the client fine, when I try to deserialize it on the client side it throws an error, cand find the server assembly.Why would it be looking for the server assembly? Any help/recomendations would be more than welcomed.
[Serializable()]
public class ChatterList : ArrayList
{
public Chatter Find(string id)
{
foreach (Chatter c in this)
{
if (c.ID == id)
return c;
}
return null;
}
public static byte[] SerializeList(ChatterList clist)
{
MemoryStream ms = new MemoryStream();
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(ms, clist);
return ms.ToArray();
}
public static object DeSerializeList(byte[] data)
{
MemoryStream ms = new MemoryStream(data);
BinaryFormatter bf = new BinaryFormatter();
return (ChatterList)bf.Deserialize(ms);
}
}