Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

X++ access modifiers

The access Modifiers in X++ are now much closer to C#'s access modifiers, and behave just the same.

Who can access foo() when it is…?

 

Please notice

  • protected internal is the union of protected and internal. I.e. a protected internal method can still be referenced by subclasses outside the defining model.
  • The extensibility attributes (Hookable, Wrappable, Replaceable) are defaulted based on the access modifier. See the relationships here: Attributes that make methods extensible.
  • InternalUseOnlyAttribute is different from Internal.
    • InternalUseOnly is an attribute telling the compiler to warn for external invocation references. As such it can be used to signal that the method will be made internal in the future. However, adding the attribute can break consumers as COC wrappers of internalUseOnly methods will get a compiler error.
    • Internal is an access modifier, controlling the IL generated by the compiler.

Share the post

X++ access modifiers

×

Subscribe to Msdn Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The Msdn Blogs.

Get updates delivered right to your inbox!

Thank you for your subscription

×