Destructors

Top  Previous  Next

What is translated > Types > Records, Classes, Interfaces > Class > Destructors

 

In Delphi a declaration of destructors start with the keyword destructor followed  by an arbitrary name. In C# the name of the of the class is also the name of the destructor preceded by the the character '~'.

 

destructor classname.foo;    ->   classname::~classname ( )

 

 

Delphi2C# tempts to find calls of destructors of the base class and to comment them out in C#. Thereby is assumed that the destructor of the base class is virtual. This has to be checked by the user.

 

 

destructor foo.Destroy();   ->    foo::~foo ( )

begin                             {                                                           

  FreeAndNil(m_Messages);           FreeAndNil ( m_Messages );                               

  inherited Destroy;                // todo check:  inherited::Destroy;                  

end;  

 

 



This page belongs to the Delphi2C# Documentation

Delphi2C# home  Content