Welcome to Shaun Luttin's public notebook. It contains rough, practical notes. The guiding idea is that, despite what marketing tells us, there are no experts at anything. Sharing our half-baked ideas helps everyone. We're all just muddling thru. Find out more about our work at bigfont.ca.
How does it work?
- it is a struct that wraps a struct
- if the underlying struct has a value, then
HasValueis true and
Valuereturns the value.
- if the underlying struct lacks a value, then
HasValueis false and
GetValueOrDefault()always returns the inner struct's default value.
When is it useful?
It is useful when we do NOT want to assume that the user (or client application, or data source...) provided the default value, when in fact the user (or client app...) provided no value.