Nullable<T> Record
A generic record that wraps a value of type T, adding the ability to represent a null (missing) state.
Remarks
Nullable<T> provides a way to distinguish between a value that has been set and one that is absent. It supports implicit conversions to and from T, comparison operators, and can be set to null by assigning the global SNull variable. Accessing the Value property when the nullable is null raises an ENullConvertException.
Syntax
Unit: Bcl.Types.Nullable
Nullable<T> = record;
Constructors
| Name | Description |
|---|---|
| Create | Creates a new Nullable<T> instance that holds the specified value. |
Operators
| Name | Description |
|---|---|
| Equality | Adapts the = operator so it returns true when both instances have the same values. |
| Inequality | Adapts the <> operator so it returns true when both instances have different values. |
| GreaterThan | Adapts the > operator so it returns true when the first parameter is bigger than the second. |
| GreaterThanOrEqual | Adapts the >= operator so it returns true when the first parameter is bigger than or equal to the second. |
| LessThan | Adapts the < operator so it returns true when the first parameter is smaller than the second. |
| LessThanOrEqual | Adapts the <= operator so it returns true when the first parameter is smaller than or equal to the second. |
Properties
| Name | Description |
|---|---|
| HasValue | Indicates whether the nullable contains a value. |
| IsNull | Indicates whether the nullable is null (has no value). |
| Value | Gets or sets the stored value. |
| ValueOrDefault | Gets the stored value, or the default value of T if the nullable is null. |
| Empty | Returns a null Nullable<T> instance with no value assigned. |