The error says that foo
is not static, but only static members of the class and parameters of constructor itself can be used in call to base constructor (in addition to other external constants).
You probably mean
public DerivedType() : base(0) {
foo = 0;
}
To be very precise following in excerpt from C# documentation: section 10.11.1 "Constructor initializers" of C# 5.0 specification.
Access to parameters of the constructor itself allowed:
The scope of the parameters given by the formal-parameter-list of an instance constructor declaration includes the constructor initializer of that declaration. Thus, a constructor initializer is permitted to access the parameters of the constructor.
But access to instance and hence instance fields is not allowed:
An instance constructor initializer cannot access the instance being created. Therefore it is a compile-time error to reference this in an argument expression of the constructor initializer, as is it a compile-time error for an argument expression to reference any instance member through a simple-name