POV-Ray : Newsgroups : povray.off-topic : C# 4.0 Default parameters : Re: C# 4.0 Default parameters Server Time
9 Oct 2024 16:15:57 EDT (-0400)
  Re: C# 4.0 Default parameters  
From: Mike Raiford
Date: 4 Feb 2009 12:13:02
Message: <4989cc9e$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.