Nullable<T>.GetValueOrDefault(T) Method

Retrieves the value of the current Nullable<T> object, or the specified default value.

Namespace: Spring
public
 function GetValueOrDefault(const defaultValue: T): T; overload;

Parameters

defaultValue
Type: T

A value to return if the HasValue property is False .

Return Value

Type: T

The value of the Value property if the HasValue property is true; otherwise, the defaultValue parameter.

The GetValueOrDefault(T) method returns a value even if the HasValue property is false (unlike the Value property, which throws an exception).