private bool LogInit = true; public jsEventLog(bool logInit) { this.LogInit = logInit; this.FinishConstructor(); } public jsEventLog(string source) { this.Source = source; this.FinishConstructor(); } public void FinishConstructor() { if (this.LogInit) { this.WriteEntry("Event log object has been initialized."); } }~~Bonnie
> public jsEventLog(bool logInit) : this() > { > if (logInit) > { > this.WriteEntry("Event log object has been initialized."); > } > } > > public jsEventLog(string source) : this(true) > { > this.Source = source; > } >>The idea is to be able to instantiate this class with a string and have it log an initialized message automatically. The WriteEntry method has several overloads, and using the one above defaults the source to the this.Source value. The problem is that when the 2nd constructor is called (by instantiation), it calls the 1st constructor before it runs the code within the 2nd constructor. Is there a way to change that order or do I have to rewrite my methods in such a way that all my methods will work with that ordering?