According to C # documentation :
A constructor can call another constructor in the same object using the this keyword.
The constructor can use the base keyword to invoke the constructor of the base class.
The documentation clearly describes how to use them separately. But nothing is said about whether this (...) and base () can be used simultaneously in the same constructor.
For example (the code causes an error):
class A { private string PropA {get; set;} public A() {} public A(string propA) this.PropA = propA; } class B : A { private string PropB_1 {get; set;} private string PropB_2 {get; set;} public B(string propB_1) => this.PropB_1 = PropB_1; public B(string propB_1, string propB_2, string propA) : this(propB_1), base(A) // ошибка { this.PropB_2 = propB_2; } } Tell me, does c # support calling this (...) and base (...) at the same time? If yes, please specify the syntax.
thiswhich will callbase- Grundythisas a result explicitly or implicitly calls thebase, so you cannot simultaneously write this and that, just call the correctthis, if it is not there - write it (you can write it private if you don't want it to be accessible from the outside) - Andrey NOP