what is the meaning of this syntax ? public ComboBoxExItem(: this("")

  • Thread starter Thread starter Sagaert Johan
  • Start date Start date
S

Sagaert Johan

Hi

i found this in an example class, but never saw this syntax before.

thais was inside a derived class of a combobox

public ComboBoxExItem() : this("")

{

}

public ComboBoxExItem(string text): this(text, -1)

{

}



why isthe method followed by : this ("") ?
 
Sagaert,

Basically, the constructor that has no parameters will call the
constructor that takes a string parameters before the code in the brackets
is called. That constructor will call the constructor that takes a string
and an integer. Once that constructor is done, it will walk back up the
stack, executing the code in the brackets.

Hope this helps.
 
Back
Top