Darren New wrote:
>>> FooBarBaz fb = new FooBarBaz() { foo = 123, bar = 4.56 };
>>> Baz takes on the default value of "" (assuming its a string)
>
> My understanding is that only works with properties. And of course Baz
> gets whatever the constructor sets it to, rather than necessarily an
> empty string. (Anyway, wouldn't it get null if not set?)
>
Right on both counts. I think string actually gets set to String.Empty
by default.
--
~Mike
Post a reply to this message
|