Hello,
This has been tested with .NET 5.
In C#, there exists the following:
if (Value is String s)
{
// can use the s variable
}
In Oxygene, we can use (and it works):
with matching s := String (Value) do begin
// can use the s variable
end;
The problem is when trying to use a value type.
The following runs in C#:
if (Value is Int32 s)
{
// can use the s variable
}
The same construct generates an InvalidCastException
in Oxygene:
with matching s := Int32 (Value) do begin
// can use the s variable
end;
EDIT: corrected the Oxygene example, as per the third message.