Skip to content

Gendarme.Rules.Design.ConsiderConvertingFieldToNullableRule(2.10)

Sebastien Pouliot edited this page Jan 22, 2011 · 2 revisions

ConsiderConvertingFieldToNullableRule

Assembly: Gendarme.Rules.Design
Version: 2.10

Description

This rule checks for pairs of fields which seem to provide the same functionality as a single nullable field. If the assembly targets version 2.0, or more recent, of the CLR then the rule will fire to let you know that a nullable field can be used instead. The rule will ignore assemblies targeting earlier versions of the CLR.

Examples

Bad example:

public class Bad {
    bool hasFoo;
    int foo;
}

Good example:

public class Good {
    int? foo;
}

Notes

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