In C#, consider we have a generic class and a concrete clas开发者_JAVA百科s
[Serializable]
public class GenericUser
{ ...
[Serializable]
public class ConcreteUser : GenericUser
{ ...
is it necessary to mark ConcreteUser as [Serializable] or inheritance will take care of it?
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.
you need to mark both, if both are to be binary serialized.
加载中,请稍侯......
精彩评论