By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,017 Members | 1,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,017 IT Pros & Developers. It's quick & easy.

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

P: n/a
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 ("") ?


Nov 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Sagaert Johan <RE*************@hotmail.com> wrote:
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 ("") ?


See http://www.pobox.com/~skeet/csharp/constructors.html

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2

P: n/a
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sagaert Johan" <RE*************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
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 ("") ?



Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.