Why is Serializable Attribute required for an object to be serialized

Posted by Keivan on Stack Overflow See other posts from Stack Overflow or by Keivan
Published on 2010-06-05T22:33:51Z Indexed on 2010/06/05 23:02 UTC
Read the original article Hit count: 223

Filed under:
|
|

Based on my understanding SerializableAttribute provides no compile time checks, as its all done at runtime, then why is it required for classes to be marked as serializable?

Couldn't sterilizer just try to serialize an object and just fail? isn't it what it does right-now when something is marked, it tries and fails. wouldn't it be better if you had to mark things as unserializable rather than serializable? that way you wouldn't have the problem of libraries not marking things as serializable?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET