With an object initializer, is it possible to optionally include setting of property?
For example:
Request request = new Request
{
Property1 = something1,
if(something)
Property2 = someting2,
Property3 = something3
};
Not that I’m aware of. Pretty sure your only option is to do it like this:
Or you could do it like this if there’s a default/null value you can set it to: