Nullable<T>.GetValueOrDefault Method
Overloads
| GetValueOrDefault |
Retrieves the value of the current Nullable<T> object, or the object's default value. |
| GetValueOrDefault(T) |
Retrieves the value of the current Nullable<T> object, or the specified default value. |
Retrieves the value of the current Nullable<T> object, or the object's default value.
Delphi
function GetValueOrDefault: T
Returns
T
Retrieves the value of the current Nullable<T> object, or the specified default value.
Delphi
function GetValueOrDefault(const defaultValue: T): T
Parameters
- defaultValue
- T
A value to return if the HasValue property is False
.
Returns
T
The value of the Value property if the HasValue
property is true; otherwise, the defaultValue
parameter.
Remarks
The GetValueOrDefault method returns a value even if the HasValue property is false (unlike the Value property, which throws an exception).