Does [Serializable] work for legacy classes?

I didnโ€™t work very much with deletion, so sorry for this rather simple question. If I get a class from an abstract class marked as [Serializable] (for transferring data via appdomain), does the other side actually re-evaluate the implementation? those. Does polymorphism work on remote / serializable?

I need to create a clone on the other hand, and not work with the original, so MarshalByRef is not an option ...

+6
c # serialization appdomain
source share
2 answers

Yes, with type deserialization, the same type is restored in the remote domain.

You can control the deserialized type using the IObjectReference template:

http://msdn.microsoft.com/en-us/library/system.runtime.serialization.iobjectreference.aspx

+2
source share

The easiest way to see that [Serializable] is not inherited is to press F12 and see "Inherited = false" in AttributeUsage. A more difficult option is RTFM at http://msdn.microsoft.com/en-us/library/bcfsa90a.aspx .

Essentially, you need to mark all classes as serializable, and they will be deserialized properly.

+3
source share

All Articles