I know [Serializable]
marks a type to be serializable and ISerializable
makes you can do custom serialization/deserialization by implementing GetObjectData
, so you can see code like this below:
[Serializable]
public class MyType : ISerializable {
...
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { ... }
}
My question is, when a type implements ISerializable
, it implicitly indicates this type is "serializable", because the logic is, if you can have control over doing a thing as you wish, then you are "capable" to do this thing, so I think it isn't it better to omit [Serializable]
when a type implements ISerializable
?