Skip to content

Gendarme.Rules.Serialization.MissingSerializableAttributeOnISerializableTypeRule(2.10)

Sebastien Pouliot edited this page Feb 9, 2011 · 3 revisions

MissingSerializableAttributeOnISerializableTypeRule

Assembly: Gendarme.Rules.Serialization
Version: 2.10

Description

This rule checks for types that implement System.ISerializable but are not decorated with the Serializable attribute. Implementing System.ISerializable is not enough to make a class serializable as this interface only gives you more control over the basic serialization process. In order for the runtime to know your type is serializable it must have the Serializable attribute.

Examples

Bad example:

// this type cannot be serialized by the runtime
public class Bad : ISerializable {
}

Good example:

[Serializable]
public class Good : ISerializable {
}

Notes

  • This rule is available since Gendarme 2.0
Clone this wiki locally