pascalabcnet/TestSuite/generics12.pas

10 lines
196 B
ObjectPascal
Raw Normal View History

2018-10-02 17:53:43 +03:00
{function DQNToNullable<T>(v: T): T; where T: record;
2017-05-25 11:37:16 +03:00
begin
var res := new System.Nullable<T>(v);
Result := res.Value;
2018-10-02 17:53:43 +03:00
end;}
2017-05-25 11:37:16 +03:00
begin
2018-10-02 17:53:43 +03:00
var t := DQNToNullable(2);
assert(t.Value = 2);
2017-05-25 11:37:16 +03:00
end.