1

Why C# constructor can only be chained (one constructor calling another) in the initializer list? ex

constructor1()
{
    // do something
}

constructor2() : this()
{
    //do something else
}

Is there a reason that this is not allowed?

constructor1()
{
    // do something
}


constructor2()
{
    constructor1();
    // do something else.
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
Yituo
  • 1,458
  • 4
  • 17
  • 26
  • 3
    Just a design choice. VB.NET lets you do the second form IIRC. – Ry- Oct 30 '18 at 00:02
  • 1
    It's difficult to answer "why" a language is designed a certain way, unless someone on the design team wants to chime in. – Joe Sewell Oct 30 '18 at 00:10
  • Here's a way to handle in which order things are executed: https://stackoverflow.com/a/985587/2321042 Regarding the "why", [check this out](http://www.csharp411.com/constructor-chaining/). – Andrew Oct 30 '18 at 00:16

0 Answers0