Retrieves the value of the current Optional{T} object, or the object’s default value.
public T GetValueOrDefault()
The value of the Value property if the HasValue property is true; otherwise, the default value of the type T.
Retrieves the value of the current Optional{T} object, or the specified default value.
public T GetValueOrDefault(T defaultValue)
parameter | description |
---|---|
defaultValue | A value to return if the HasValue property is false. |
The value of the Value property if the HasValue property is true; otherwise, the defaultValue parameter.