Last Updated: February 25, 2016
·
2.604K
· jgemedina

C# - Default value for a Property if Null

Here's the gist, handy to set other values different than null if an object property is null.

https://gist.github.com/1249714

2 Responses
Add your response

Why is obj passed as a ref parameter? It's never assigned to.

over 1 year ago ·

True, that code in the Gist is quite old, wasn't sure of the use of ref and out, had not updated it since.

Makes no sense there since the method struct is modified, not there reference itself, I just updated the Gist.

Thanks.

over 1 year ago ·