Let\'s say I have a simple set of classes like this:
class Bus
{
Driver busDriver = new Driver();
}
class
Interestingly if Driver
is defined as above:
class Driver
{
Shoe[] shoes = { new Shoe(), new Shoe() };
}
Then when Shoe
is made IDisposable
, FxCop (v1.36) does not complain that Driver
should also be IDisposable
.
However if it is defined like this:
class Driver
{
Shoe leftShoe = new Shoe();
Shoe rightShoe = new Shoe();
}
then it will complain.
I suspect that this is just a limitation of FxCop, rather than a solution, because in the first version the Shoe
instances are still being created by the Driver
and still need to be disposed somehow.