Skip to content

Gendarme.Rules.Serialization.MarkEnumerationsAsSerializableRule(git)

Sebastien Pouliot edited this page Mar 2, 2011 · 1 revision

MarkEnumerationsAsSerializableRule

Assembly: Gendarme.Rules.Serialization
Version: git

Description

This rule warns when it founds an enum that is not decorated with a Serializable attribute. Enums, even without the attribute, are always serializable. Marking them as such makes the source code more readable.

Examples

Bad example:

public enum Colors {
    Black,
    White
}

Good example:

[Serializable]
public enum Colors {
    Black,
    White
}

Notes

  • This rule is available since Gendarme 2.2

Source code

You can browse the latest source code of this rule on github.com

Clone this wiki locally