Salut,
Il s'agit de la même chose, le String est mappé sur System.String. Ce qui est ajouté c'est juste un class helper sur TObject.
Le code suivant ne provoque aucune erreur :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
program Project2;
{$APPTYPE CONSOLE}
{$R+} // ou {$R-}
uses
SysUtils;
var s : System.String;
// ou s : String;
obj : TObject;
obj2 : &Object;
begin
try
s:='test';
obj:=TObject.Create;
obj2:=&Object.Create;
Writeln('Type');
Writeln(S.GetType);
Writeln((Obj.tostring).GetType);
Writeln('Contenu');
Writeln(S);
Writeln(Obj.tostring);
Writeln(Obj2.tostring);
S:=Obj.tostring;
Writeln(S);
S:=Obj2.tostring;
Writeln(S);
Readln;
except
on E:Exception do
Writeln(E.Classname, ': ', E.Message);
end;
end. |
Je doute de l'explication concernant la cause du pb que tu rencontres
D2007 patché, XP Sp2, Fx 2.0 patché
Partager