Export (0) Print
Expand All

Best Practice for Destructors (finalize) [AX 2012]

Updated: December 2, 2011

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

The X++ language has no destructor method. A destructor method is one that is called by the system when there are no more references to an object and the system starts to destroy the object.

The Object class has a finalize method, but finalize is empty and the Microsoft Dynamics AX system never calls it. You can override the finalize method if you want a method to contain code that might otherwise belong in a destructor method. However, finalize is not called unless your code calls it explicitly.

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. get your copy at the MS Press Store

Community Additions

© 2015 Microsoft