Reading an ASP.Net book I saw the "[Serializable]" line and I do not know what they mean:
[Serializable]
public class someClass
{...}
Does that make the entire class serializable?
Many Thanks!
http://msdn2.microsoft.com/en-us/library/system.serializableattribute.aspx
-- Dan
Yes, all the members, properties and methods of the class will be serialize to the format specified..i.e. binary, xml etc..
But don't I have to implement some interface? How about some member that is not serializable?
Did you read the MSDN article? Only fields in a class are serialized when applying the SerializableAttribute meta tag. The ISerialable interface is just one way to serialize a class. If it is implemented on a class that also uses SerializableAttribute, the interface will override the process. ISerialable provides more control over how the data is serialized. You can control which fields are serialized by with SerializableAttribute by using theNonSerializedAttribute meta tag.
-- Dan
0 comments:
Post a Comment