X++ in AX7: Internal keyword


internal is a new keyword in X++. It has the same semantics as in C#.

When you mark a class or method as internal, then it can only be accessed from within the model where it is defined.

internal class MyInternalClass 
{  
    internal void myInternalMethod() 
    {  
    }  
}

Notice, you can define internal methods on public classes too.

 

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

Comments (4)

  1. Evaldas L says:

    Thanks, that makes sense. However, I still believe it will not be used often 🙂

  2. Volker Deuss says:

    Hi Michael,

    it should be "...within the package where it is defined." to be more precise, right? Or am I confusing this? Or did you choose to be a little inaccurate in order to avoid confusion amongst those who are new to AX7? 🙂

    Cheers

  3. Good question Evaldas 🙂

    Here is one example:

    If you are building a library, you can use the internal keyword to hide types you don't want to expose. This will give a sharply defined API for your consumers, and lower the responsibility on you on backwards compatibility - internal classes are yours to control, change, delete, etc.

  4. Evaldas L says:

    What's the use of it?

Skip to main content