X++ in AX7: Static classes


You can now mark a class as static.

static class MyClass
{
}  
 

It will not be possible to create instances of this class. This is useful for classes providing static methods only – like the Global class.

 

THIS POST APPLIES TO MICROSOFT DYNAMICS AX7 TECHINCAL PREVIEW; IS PROVIDED AS-IS AND CONFERS NO RIGHTS.

Comments (3)

  1. msmfp says:

    Hi José A. Estevan

    From an X++ perspective tables are still a special type in X++ deriving from common, not from object.  

    From an IL perspective (which is what the X++ compiler creates), then a table is an IL class extending Microsoft.Dynamics.Ax.Xpp.Common. As tables hold state and you can have instances –  it is not a static class.

    Hi dick wenning.

    A static class is a class that cannot be instantiated anywhere – regardless of AOS.  There is not a shared instance anywhere, so you need not be concerned about scoping when marking a class as static.

    Best wishes,

    Michael

  2. dick wenning says:

    is this global in scope of the AOS server, or is this over all cluster AOS,

    or does this cluster not exists anymore on AX because we are IIS based.

  3. jaestevan says:

    Are all tables considered static classes from the X++ point of view? What about inherited tables?

Skip to main content