You don't (without a lot of hassle). Part of the Type name is the assembly it came from, so the Type in your two applications is different. The easiest thing to do (and I'd argue most proper) is to have a shared assembly for your shared Types (as you've already discovered). The next easiest thing to do is use XML serialization instead. If you are adamant on having your types hosted in two different assemblies, you can accomplish this easier with XML serialization. Finally, for binary serialization, look into ISerializationSurrogate. Basically you'd have to forego automatic binary serialization in favor of ISerializable, but it's a way to do it.
- Marked As Answer byK.Kong Monday, September 14, 2009 1:13 AM
-
|