How do you assign null to a Delphi.net Nullable? I have a field which previously contained a value , I need to clear its value back to null.
depth : Nullable<Double>;
Procedure ClearDepth;
begin
depth := Nil;
end;
The above creates the error Error: E2010 Incompatible types : 'Nullable<System.Double>' and 'Pointer'
. using Null
in place of Nil
gives the same error with Variant
in place of Pointer
. I wondered if I should be using a special constructor to generate a null nullable but I couldn't see one in the documentation?
The following works but doesn't seem like a great solution, can anyone suggest a better way?
Procedure ClearDepth;
var
uninitialisedValue : Nullable<Double>;
begin
depth := uninitialisedValue;
end;