Some notes on software development... RSS 2.0
# Monday, 28 April 2008

Scott Gu has a nice article describing the null coalescing operator when used with LINQ queries.

A quick example:
image 

The Qty & Size properties for the anonymous type will be defined as integer types NOT nullable integers. If any of the spec.Attribute("x") values are null or don't exist for any reason, the value returned will be a simple integer zero.
This is because using the null coalescing operator (??) is enforcing that null can never ever happen.

LINKS
Scott Gu blog article

Monday, 28 April 2008 17:01:12 (GMT Standard Time, UTC+00:00)  #    -
C#
Navigation

Sign In
Extras
Statistics
Total Posts: 116
This Year: 0
This Month: 0
This Week: 0
Comments: 36
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2018
Hadrian Phillips

All Content © 2018, Hadrian Phillips
DasBlog theme 'Business' created by Christoph De Baene (delarou)