Question: When assigning a default default-value to a field (here false to a bool), FxCop says:

```
Resolution   : "'Bar.Bar()' initializes field 'Bar.foo' 
               of type 'bool' to false. Remove this initialization 
               because it will be done automatically by the runtime."

```

Now, I know that code as `int a = 0` or `bool ok = false` is introducing some redundancy, but to me it seems a very, very good code-practice, one that my teachers insisted on righteously in my opinion.

Not only is the performance penalty very little, more importantly: relying on the default is relying on the knowledge of each programmer ever to use a piece of code, on every datatype that comes with a default. (DateTime?)

Seriously, I think this is very strange: the very program that should protect you from making all too obvious mistakes, is suggesting here to make one, only for some increased performance? (we're talking about *initialization code* here, only executed once! Programmers who care that much, can of course omit the initialization (and should probably use C or assembler :-) ).

Is FxCop making an obvious mistake here, or is there more to it?

> 
> Two updates :
> 
> 
> 1. This is not just my opinion, but what I have been taught at university
> (Belgium). Not that I like to use an
> [*argumentum ad verecundiam*](http://philosophy.lander.edu/logic/authority.html), but
> just to show that it isn't just my
> opinion. And concerning that:
> 2. My apologies, I just found this one:
> 
> 
> [Should I always/ever/never initialize object fields to default values?](https://stackoverflow.com/questions/636102/should-i-always-ever-never-initialize-object-fields-to-default-values)
> 
> 
>

Answer: 
FxCop has to provide rules for everyone, so if this rule doesn't appeal to you, just exclude it.

Now, I would suggest that if you want to explicitly declare a default value, use a constant (or static readonly variable) to do it. It will be even clearer than initializing with a value, and FXCop won't complain.

```cs
private const int DEFAULT_AGE = 0;

private int age = 0; // FXCop complains
private int age = DEFAULT_AGE; // FXCop is happy

private static readonly DateTime DEFAULT_BIRTH_DATE = default(DateTime);

private DateTime birthDate = default(DateTime); // FXCop doesn't complain, but it isn't as readable as below
private DateTime birthDate = DEFAULT_BIRTH_DATE; // Everyone's happy

```
You have to remember that FxCop rules are only guidelines, they are not unbreakable. It even says so on the page for the description of the rule you mentioned (<http://msdn.microsoft.com/en-us/library/ms182274(VS.80).aspx>, emphasis mine):

**When to Exclude Warnings**:

Exclude a warning from this rule if the constructor calls another constructor in the same or base class that initializes the field to a non-default value. **It is also safe to exclude a warning from this rule, or disable the rule entirely, if performance and code maintenance are not priorities**.

Now, the rule isn't entirely incorrect, but like it says, this is not a priority for you, so just disable the rule.