In C#, if I want to serialize an instance with XmlSerializer
, the object's type doesn't have to be marked with [Serializable]
attribute. However, for other serialization approaches, such as DataContractSerializer
, needs the class be marked as [Serializable]
or [DataContract]
.
Is there any standard or pattern about serialization requirement?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…