Say I have this class:
class FooBar
{
public FooBar() : this(0x666f6f, 0x626172)
{
}
public FooBar(int foo, int bar)
{
...
}
...
}
If I did this:
FooBar foobar = new FooBar();
would the non-parameterized constructor execute first, then the parameterized one, or is it the other way around?
MSDN has a similar example with
base
:And states:
Nevertheless, to be sure here's my test:
Prints
so the parameterized constructor executes before the explicitly invoked one.