the namespace Borland.VCL.Classes contains a class "TStringList".
Do i have to free instances of Borland.VCL.Classes.TStringList or are they
automatically destroyed when the go out of scope? (are they interfaces?)
TIA;
Ralf
> Do i have to free instances of Borland.VCL.Classes.TStringList or
> are they automatically destroyed when the go out of scope? (are they
> interfaces?)
All instances in .NET are freed when they go out of scope. But if a
class has an overridden destructor (I can't remember if TStringList
does in .NET, but you have the source, so go look) then you certainly
should call Free since that's how Delphi implements IDisposable.
--
Craig Stuntz [TeamB] · Vertex Systems Corp. · Columbus, OH
Delphi/InterBase Weblog : http://blogs.teamb.com/craigstuntz
Want to help make Delphi and InterBase better? Use QC!
http://qc.borland.com -- Vote for important issues
Hello,
> All instances in .NET are freed when they go out of scope. But if a
i was not sure if i remembered correctly :-)
> class has an overridden destructor (I can't remember if TStringList
> does in .NET, but you have the source, so go look) then you certainly
> should call Free since that's how Delphi implements IDisposable.
OK, thats good to know.
Thanks Craig,
Ralf
> Do i have to free instances of Borland.VCL.Classes.TStringList or are they
> automatically destroyed when the go out of scope? (are they interfaces?)
They are automatically cleaned up by the GC. This may be at some time
much later than when they go out of scope.
The only reasonto force a Free on something like a TStringList is if
th Objects[] property contains references to objects which are
wrappers for unmanaged resources. (Window handles, file handles, etc)
--
Marc Rohloff [TeamB]
marc rohloff -at- myrealbox -dot- com