Extended nullable types sample

This commit is contained in:
Daniele Teti 2024-07-29 09:18:21 +02:00
parent d932857f34
commit 7e28bc959e

View File

@ -39,6 +39,20 @@ begin
{
lNullableInt.Value raises exception if "lNullableInt.IsNull = True"
}
lNullableInt := nil; // set to null
Assert(lNullableInt.IsNull);
Assert(not lNullableInt.HasValue);
lNullableInt := 123;
Assert(lNullableInt.HasValue);
lNullableInt.SetNull; // set to null
Assert(lNullableInt.IsNull);
Assert(not lNullableInt.HasValue);
lNullableInt.Clear; // set to null
Assert(lNullableInt.IsNull);
Assert(not lNullableInt.HasValue);
end;
begin