IDE: _Visual Studio 2015
Version: 9.1.100.2073
Target (If relevant): Cocoa / Windows
Description:
In our dictionary class we have a TryGetValue method.
method TryGetValue(AKey: T; out AValue: U): TBoolean;
The following code:
var value: TInteger;
if WZones2.TryGetValue(AWZone, out value) then exit value else exit -1;
If I compile it in cocoa the compiler produces the following error:
Gravedad Código Descripción Proyecto Archivo Línea Estado de supresión
Error (E486) Parameter 3 is “nullable TInteger”, should be “out Int32”, in call to class method TDictionary<TString,Int32>.TryGetValue(&self: TDictionary<TString,Int32>; AKey: TString; out AValue: Int32): TBoolean SendaObjects.BaseLib.WPF C:\SendaObjects.BaseLib\SendaObjects.BaseLib.Sources\System\TTimeZone.pas 2227
Which forces me to put the code in Cocoa as follows:
var value: nullable TInteger;
if WZones2.TryGetValue(AWZone, out value) then exit value else exit -1;
However, if I now compile this code in WPF it produces the following error:
Gravedad Código Descripción Proyecto Archivo Línea Estado de supresión
Error (E486) Parameter 3 is “nullable TInteger”, should be “out Int32”, in call to class method TDictionary<TString,Int32>.TryGetValue(&self: TDictionary<TString,Int32>; AKey: TString; out AValue: Int32): TBoolean SendaObjects.BaseLib.WPF C:\SendaObjects.BaseLib\SendaObjects.BaseLib.Sources\System\TTimeZone.pas 2227
Which forces me to put the code in WPF as follows:
var value: TInteger;
if WZones2.TryGetValue(AWZone, out value) then exit value else exit -1;
Hahaha,
Which version of the code is correct?
I think this version of Elements can not be used.
Best regards,
Jose A.