[Mono-dev] Problem with BinarySerialization

Robert Jordan robertj at gmx.net
Tue Feb 2 09:00:08 EST 2010

On 02.02.2010 14:35, PFJ wrote:
>> Thus, the only *clean* way to solve this is introducing a shared
>> assembly implementing the classes you want to serialize. It's a
>> common pattern.
> As the serializer is only used once, can the other app just deserialize and
> use it? I've reimplemented the Elements class but now just have a little
> problem in accessing it...

It doesn't matter how often, in which way or how symmetric
the de/serialization is performed. What counts is the type identity.

> 				var elementgo = new List<Elements>();


> 				elementgo = (Elements)bf.Deserialize(stream);

var elementgo = (List<Elements>) bf.Deserialize(stream);

> Problem is the casting of the class to deserialize - it's not an object so
> can't use it and something like Elements el = new Elements(); isn't cutting
> it either...

See above.


More information about the Mono-devel-list mailing list