In C#, consider we have a generic class and a concrete class
[Serializable]
public class GenericUser
{ ...
[Serializable]
public class ConcreteUser : GenericUser
{ ...
is it necessary to mark ConcreteUser as [Serializable]
or inheritance will take care of it?
Allows an object to control its own serialization and deserialization.
Serialization is the process of converting an object into a stream of bytes to store the object or transmit it to memory, a database, or a file. Its main purpose is to save the state of an object in order to be able to recreate it when needed.
Inherited
is set to false
with the [AttributeUsage]
of SerializableAttribute
, so yes, you need to set it on the concrete class.
See http://msdn.microsoft.com/en-us/library/system.serializableattribute.aspx for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With