Reputation: 26929
Exactly this code: compile error says use of base is not valid in this context.
public class UCMComboBoxCellType : FarPoint.Win.Spread.CellType.ComboBoxCellType
{
public UCMComboBoxCellType()
{
base();
this.ListWidth = 0;
}
}
but why? I cannot figure out.
Upvotes: 0
Views: 129
Reputation: 42666
Because you don't.
If you needed to call a parameterized baseclass constructor, you'd do so like so:
public MyClass(string msg)
: base(msg)
{
...
}
but in a parameterless case, there is no need -- it is implied that the derived constructor will call the base class constructor first.
Upvotes: 2
Reputation: 3441
Try this:
public class UCMComboBoxCellType : FarPoint.Win.Spread.CellType.ComboBoxCellType
{
public UCMComboBoxCellType() : base()
{
this.ListWidth = 0;
}
}
Upvotes: 1
Reputation: 6259
In C# you chain constructors like this:
public UCMComboBoxCellType() : base()
{
this.ListWidth = 0;
}
What you tried is the Java way.
Upvotes: 8