-
Notifications
You must be signed in to change notification settings - Fork 4
Gendarme.Rules.Serialization.MarkAllNonSerializableFieldsRule(git)
Assembly: Gendarme.Rules.Serialization
Version: git
This rule checks for serializable types, i.e. decorated with the Serializable attribute, and checks to see if all its fields are serializable as well. If not the rule will fire unless the field is decorated with the NonSerialized attribute. The rule will also warn if the field type is an interface as it is not possible, before execution time, to know for certain if the type can be serialized or not.
Bad example:
class NonSerializableClass {
}
[Serializable]
class SerializableClass {
NonSerializableClass field;
}
Good example:
class NonSerializableClass {
}
[Serializable]
class SerializableClass {
[NonSerialized]
NonSerializableClass field;
}
- This rule is available since Gendarme 2.0
You can browse the latest source code of this rule on github.com
Note that this page was autogenerated (3/17/2011 1:55:44 PM) based on the xmldoc
comments inside the rules source code and cannot be edited from this wiki.
Please report any documentation errors, typos or suggestions to the
Gendarme Mailing List. Thanks!