Hi guys,
Just got a noob question here:
Why does the designer of C# (and Java too) make it that you have to mark a class as Serializable (or inherit ISerializable) to be able to serialize it? What's wrong of being able to serialize any object when you want to without explicitly saying you want. Does this has something to do with how the object is going to be represented/optimized by the compiler?
By the way, I let BinaryFormatter serialize an ArrayList to a file and it succeeded. But when I look at the hierachy of inheritance it looks like none of ArrayList's superclasses are serializable? So why can I serialize it without error or did I missed somewhere where it was declared so?
Thanks
Just got a noob question here:
Why does the designer of C# (and Java too) make it that you have to mark a class as Serializable (or inherit ISerializable) to be able to serialize it? What's wrong of being able to serialize any object when you want to without explicitly saying you want. Does this has something to do with how the object is going to be represented/optimized by the compiler?
By the way, I let BinaryFormatter serialize an ArrayList to a file and it succeeded. But when I look at the hierachy of inheritance it looks like none of ArrayList's superclasses are serializable? So why can I serialize it without error or did I missed somewhere where it was declared so?
Thanks